Symptoms

When a checkbox is housed in a datagrid's templatecolumn, that checkbox has the AutoPostBack property set to true, and the datagrid's row is disabled, the checkbox will fire its CheckChanged event on any subsequent postback even though the row's state did not change.

More Information

Steps to reproduce behavior

Reproduction solution here.  Extract all files to a directory and set up that directory as a virtual directory in IIS named "DisableBugRepro".

If you have a datagrid with the following column definition:

<asp:TemplateColumn>
 <ItemTemplate>
 <asp:CheckBox AutoPostBack="True" OnCheckedChanged="CheckChanged" Runat="server" ID="chk" />
 </ItemTemplate>
</asp:TemplateColumn>

And you are:

  1. Setting the checkbox's checked propery in the DataGrid's ItemDataBound event
  2. Disabling a row

Then on the next postback immediately after disabling the row, the CheckChanged function will be called. 

Cause

Heck if I know.

Resolution

To work around this behavior, disable the checkbox control individually before disabling the row.

 

Status

Seems fixed in Whidbey PDC pre-beta 

 

More Information

See repro solution here.