dynamic controls in a Webcontrol

S

sameer

Hi All,
Environment: ASP.Net , framework 1.1, VS2003. Database: Sql server 2000
I created a webcontrol( ascx) with all server side controls and the controsl
are Submit button, Dropdown and a placeHolder in which dynamic CheckBoxes are
created depending on the option the user has selected in the Dropdown. the
AutoPostBack property of the dropdown is set to True.

I then take this control and throw it in my webpage and boom all works
perfect, the dropdown is loaded and the checkboxes are loaded dynamically
from the value selected in the dropdown. but their is a problem.

The dynamic creation of my controls; depends on the value of the dropdown
control( whose AutoPostBack Property is set to true). To make dynamic
controls persist state so that i can check their values when the user hits on
Submit button they have to be created in the INIT event of the webcontrol but
when i try dong this in this event i dont see the SelectedValue of the
dropdown which caused this postback and so my controls are not being
created(The dropdown is like new with out even any databind in this event).
how can i resolve this problem?
I can do all this in the Dropdown;s selectedindexchanged event( or what
ever is the right event) where i can see the new value user has selected but
the dynamic controls will not persist state and i will not be able to check
their values when the user hits on submit. Please suggest a way to check the
dropdown and create the dynamic controls so that i can see their values when
the user hits on submit.

Sameer
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top