I have been digging through the help and could not find a solution.
I need to select a row server side based on the ID. The following piece of code does not find the item:
if (Session["selID"] != null)
{
GridDataItem item = RadGrid1.MasterTableView.FindItemByKeyValue("Container_ID", Session["selID"].ToString());
item.Selected = true;
Session["selID"] = null;
}
So I'm using the following method
if (Session["selID"] != null)
{
foreach (GridItem item in RadGrid1.MasterTableView.Items)
{
if (item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)item;
if (Session["selID"].ToString().Equals(dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["Container_ID"].ToString()))
{
dataItem.Selected = true;
Session["selID"] = null;
break;
}
}
}
}
Somehow I feel that there has to be a better way to do it. I will appreciate if you could please suggest the optimum way.
Thanks
Som