RadGrid Row Select
If you want to select row in RadGrid then set some RadGrid properties like
<ClientSettings Selecting-AllowRowSelect="true" Selecting-EnableDragToSelectRows="false">
<MasterTableView DataKeyNames="ID">
If you want to select first row then use below code
if (RadGrid.Items.Count > 0)
{
RadGrid.MasterTableView.Items[0].Selected = true;
}
If you want to select any row on that basis of data key name then use below code
GridDataItem item = RadGrid.MasterTableView.FindItemByKeyValue("ID", "4");
if (item != null)
{
item.Selected = true;
}
<ClientSettings Selecting-AllowRowSelect="true" Selecting-EnableDragToSelectRows="false">
<MasterTableView DataKeyNames="ID">
If you want to select first row then use below code
if (RadGrid.Items.Count > 0)
{
RadGrid.MasterTableView.Items[0].Selected = true;
}
If you want to select any row on that basis of data key name then use below code
GridDataItem item = RadGrid.MasterTableView.FindItemByKeyValue("ID", "4");
if (item != null)
{
item.Selected = true;
}
Comments
Post a Comment