Hi
I have a datagrid with a GridClientSelectColumn. When I load page from an external source I would like to set the checked value of a particular row. I have written the following code to run on the data grid's itemDataBound event:
protected void gridLocations_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
int iLocation = (int) (Int32) item.OwnerTableView.DataKeyValues[item.ItemIndex]["location_id"];
if (iLocation == iLocationIdToCheck)
{
TableCell tc = item["colSelect"];
CheckBox chkSelect = tc.Controls[0] as CheckBox;
chkSelect.Checked = true;
}
}
}
This compiles and runs through without any exceptions, but when the grid loads, the checkbox isnt actually checked. What needs to be done to have a particular checkbox selected?
Thanks
I have a datagrid with a GridClientSelectColumn. When I load page from an external source I would like to set the checked value of a particular row. I have written the following code to run on the data grid's itemDataBound event:
protected void gridLocations_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
int iLocation = (int) (Int32) item.OwnerTableView.DataKeyValues[item.ItemIndex]["location_id"];
if (iLocation == iLocationIdToCheck)
{
TableCell tc = item["colSelect"];
CheckBox chkSelect = tc.Controls[0] as CheckBox;
chkSelect.Checked = true;
}
}
}
This compiles and runs through without any exceptions, but when the grid loads, the checkbox isnt actually checked. What needs to be done to have a particular checkbox selected?
Thanks