Checkbox vs Single Click enabled

Aug 17, 2007 at 5:08 AM
It seems that these two features do not play nicely together as the act of selecting a checkbox is interpreted as a onclick which generates a postback if you have the single click functionality enabled. Once the postback occurs the checkbox state is lost.
Sep 11, 2007 at 2:32 AM
add a CheckChanged event in checkbox:

<asp:TemplateField HeaderText="IsActive">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<asp:CheckBox id="chkIsActive" runat="server" Checked="true" AutoPostback="true" OnCheckedChanged="chkIsActive_CheckedChanged"></asp:CheckBox>

In code behind:

protected void chkIsActive_CheckedChanged(object sender, EventArgs e)
GridView1.RowClick -=new CustomControls.Grid.RowClickEventHandler(GridView1_RowClick);

Basically, this will disable the RowClick event in your extended gridview when you click the checkbox.

Hope this helps!