Checkbox in DataGrid Not Firing OnCheckedChanged events.

Discussion in 'ASP .Net Datagrid Control' started by arby, Jan 30, 2004.

  1. arby

    arby Guest

    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
     
    arby, Jan 30, 2004
    #1
    1. Advertising

  2. Are you in release mode? Break points have no traction in release mode.

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "arby" <> wrote in message
    news:...
    > 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
     
    Alvin Bruney [MVP], Jan 31, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Homa
    Replies:
    3
    Views:
    14,998
    nchavan
    Jul 23, 2009
  2. Maziar Aflatoun

    asp checkbox checking for OnCheckedChanged value

    Maziar Aflatoun, Sep 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    23,400
    radu_m
    Dec 29, 2008
  3. Replies:
    1
    Views:
    5,132
    =?Utf-8?B?UmFq?=
    Jul 5, 2006
  4. Danielle
    Replies:
    1
    Views:
    2,819
    Munna
    Jun 8, 2008
  5. Hitesh Jain

    oncheckedchanged event is not firing everytime on checkbox

    Hitesh Jain, Oct 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    1,622
    Robert Koritnik
    Oct 15, 2004
Loading...

Share This Page