K
kasterborus
I've been working on a web control class that generates a grid of
checkboxes dynamically, based upon a DB query. I've been creating them
in the Render method as needed.
CheckBox _cb = new CheckBox();
_cb.Text = "Assigned";
_cb.RenderControl(tw);
The only problem is of course any user interaction with the checkboxes
is lost when posting back.
I've tried adding them to the .Controls collection, setting
EnableViewState to true, but nothing seems to work. The closest I've
come to success is when I store the Checkboxes in the Viewstate
explictly, but they are the "previous" checkboxes - no user interaction
is recorded in them after postback.
I know this has something to do with EnsureChildControls() and
CreateChildControls() but all my attempts so far have failed.
How do I tie a checkbox control (newly created or otherwise) to the
state of the checkbox in the HTML, so that it contains any new user
interaction?
Thanks in advance!
checkboxes dynamically, based upon a DB query. I've been creating them
in the Render method as needed.
CheckBox _cb = new CheckBox();
_cb.Text = "Assigned";
_cb.RenderControl(tw);
The only problem is of course any user interaction with the checkboxes
is lost when posting back.
I've tried adding them to the .Controls collection, setting
EnableViewState to true, but nothing seems to work. The closest I've
come to success is when I store the Checkboxes in the Viewstate
explictly, but they are the "previous" checkboxes - no user interaction
is recorded in them after postback.
I know this has something to do with EnsureChildControls() and
CreateChildControls() but all my attempts so far have failed.
How do I tie a checkbox control (newly created or otherwise) to the
state of the checkbox in the HTML, so that it contains any new user
interaction?
Thanks in advance!