Can anyone please tell me that how to get the ID of Custom Object like, I am loading all the Custom Object by describeglobal() and than setting the name, label and plural label as the datasource for a gridview.
Now I want ID of that particular custom object on click in GridView. My code is this ::
DataTable table = new DataTable();
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Label", typeof(string));
table.Columns.Add("labelPlural", typeof(string));
SforceService binding = (SforceService)Session["myobject"];
DescribeGlobalResult dgr = binding.describeGlobal();
DescribeSObjectResult[] dsrArray;
for (int i = 0; i < dgr.sobjects.Length; i++)
{
//DescribeSObjectResult[] arr = new DescribeSObjectResult[500];
if (dgr.sobjects[i].name.Contains("__c"))
{
dsrArray = binding.describeSObjects(new string[] { dgr.sobjects[i].name });
for (int j = 0; j < dsrArray.Length; j++)
{
string Name = dsrArray[j].name;
string Label = dsrArray[j].label;
string Plural_Label = dsrArray[j].labelPlural;
table.Rows.Add(Name, Label, Plural_Label);
}
}
}
grdObjects.DataSource = table;
grdObjects.DataBind();
I am setting the label as linkbutton in the gridview
Regards Raman