order of events - dynamic checkbox events

Discussion in 'ASP .Net' started by =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005.

  1. Hi there,

    I am databinding a datagrid on the onload with the usual !IsPostBack
    condition.

    I have to create some dynamic checkboxes, because i dont know how many i
    will need until the dataset comes back. take it as red that writing them into
    the aspx is not an option.

    So on the databind function of my grid I am doing the following:

    CheckBox cb = new CheckBox();
    cb.AutoPostBack=true;
    cb.CheckedChanged += new System.EventHandler(cbPersonSelect_CheckChanged);

    Once the page has loaded, hitting the checkbox just causes a postback and
    nothing else. It is not raising the event. I know it is referencing the
    correct function because if i change the above to
    cb.CheckedChanged += new
    System.EventHandler(cbPersonSelectBLAHBLAH_CheckChanged);

    It says my page definition doesnt contain cbPersonSelectBLAHBLAh etc..

    I know it has something to do with the Page_Init which instanstiates all
    server control events or something like that but I've tried some different
    ways (putting the databind in the Page_Init etc) and it never raises the
    event. Does anyone have a work around or can tell me what i'm doing wrong?
    All i want to do is tell the checkbox to raise an event it cant be that hard
    ! Thanks.


    cell.Controls.Add(cb);
     
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005
    #1
    1. Advertisements

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. Replies:
    5
    Views:
    5,815
  2. Replies:
    1
    Views:
    650
    newsgroups.comcast.net
    Apr 10, 2005
  3. tshad
    Replies:
    0
    Views:
    755
    tshad
    Apr 15, 2005
  4. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    Order of events problem with dynamic checkbox. Please help!

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    484
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Aug 17, 2005
  5. dje

    dynamic events on dynamic controls

    dje, Jun 25, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    252
    Robert Koritnik
    Jun 28, 2004
  6. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    671
    Chris
    Aug 30, 2005
  7. pizzy
    Replies:
    0
    Views:
    286
    pizzy
    Mar 23, 2005
  8. pizzy
    Replies:
    5
    Views:
    622
    pizzy
    Apr 12, 2005
Loading...