G
Guest
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);
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);