Checkbox in DataGrid Not Firing OnCheckedChanged events.

A

arby

Hi There,

I have a datagrid with the following template column definition:

<asp:TemplateColumn HeaderText="Select">
<ItemTemplate>
<asp:CheckBox Runat="server" ID="chkAdd"
AutoPostBack="True">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>


Next, under my design window I double-clicked on my ItemCommand event
and added the following code:


private void gridMediaResults_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{

string test;
test = "hello world.";


)

.... I also have this as well ...

private void chkSelect_CheckedChanged(object sender, System.EventArgs e)
{
string test = "";
test = "ok?";
}



I then start up my page and everything looks good, I have a datagrid
with my checkboxes. However, whenever I click on the checkboxes the
code does not get into the event handler - I know this by putting a
breakpoint in the debugger and I never gain control. Just to test I
tried other methods, like populating a textbox from this event and
nothing would work.

From reading posts, this seems to be the best method for handling
dynamically created checkbox events. Is there something I'm doing
wrong or maybe a better method?

Thanks
Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top