order of events - dynamic checkbox events

Discussion in 'ASP .Net' started by Guest, Aug 17, 2005.

  1. Guest

    Guest Guest

    Hi there,

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

    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.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

    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.

    Guest, Aug 17, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.