Is there a way to limit client-side row selection to one row per grouping in a radgrid without causing a postback every time?
I used an old example (see below), but each click of a checkbox causes a postback which is disruptive to the process. I wasn't sure if there was some built in functionality or an easy way to check at the end if too many were selected.
Thank you..
I used an old example (see below), but each click of a checkbox causes a postback which is disruptive to the process. I wasn't sure if there was some built in functionality or an easy way to check at the end if too many were selected.
Thank you..
<
radG:GridTemplateColumn
UniqueName
=
"CheckBoxColumn"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"CheckBox1"
runat
=
"server"
AutoPostBack
=
"true"
OnCheckedChanged
=
"CheckedChanged"
/>
</
ItemTemplate
>
</
radG:GridTemplateColumn
>
public void CheckedChanged(object sender, EventArgs e)
{
GridDataItem checkedItem = (GridDataItem)(sender as CheckBox).NamingContainer;
string checkedItemIndex = checkedItem.GroupIndex.Substring(checkedItem.GroupIndex.LastIndexOf('_'), 2);
foreach (GridDataItem item in checkedItem.OwnerTableView.Items)
{
string currItemIndex = item.GroupIndex.Substring(item.GroupIndex.LastIndexOf('_'), 2);
if (checkedItem.GroupIndex.StartsWith(item.GroupIndex.Substring(0,1)) && currItemIndex != checkedItemIndex)
{
(item.FindControl("CheckBox1") as CheckBox).Checked = false;
}
}
}