G
Guest
I'm creating a set of dynamic controls on a webpage by calling my
BuildControls sub in the Page_Init sub. I recreate the controls by calling
the BuildControls sub in the LoadViewState override procedure. The set of
controls will not always be the same (based on the selection the user makes
in a static ddl). The controls are persisted perfectly.
The problem I'm experiencing is that when one of the dynamic ddl's (let's
say ddl1) is changed I want to save the value selected so that I can use the
value when the BuildControls sub runs to populate another ddl control (let's
say ddl2) in the LoadViewState procedure. I'm attaching a SelectIndexChanged
event to ddl1 and setting it's AutoPostBack property to "True". The problem
is that in the LoadViewState proc. ddl1 doesn't seem to exist. I've been
reading a lot about the page execution cycle, but I'm stumped as to where to
save the selected value of ddl1 so that I can use it when I rebuild my
controls (and repopulate ddl2).
I even tried running the BuildControls sub in my SelectIndexChanged event
since it runs after the LoadViewState sub and the controls exist at this
point. The problem then is I get 2 sets of the same controls. One set is
populated correctly and the 2nd has the original defaults.
BuildControls sub in the Page_Init sub. I recreate the controls by calling
the BuildControls sub in the LoadViewState override procedure. The set of
controls will not always be the same (based on the selection the user makes
in a static ddl). The controls are persisted perfectly.
The problem I'm experiencing is that when one of the dynamic ddl's (let's
say ddl1) is changed I want to save the value selected so that I can use the
value when the BuildControls sub runs to populate another ddl control (let's
say ddl2) in the LoadViewState procedure. I'm attaching a SelectIndexChanged
event to ddl1 and setting it's AutoPostBack property to "True". The problem
is that in the LoadViewState proc. ddl1 doesn't seem to exist. I've been
reading a lot about the page execution cycle, but I'm stumped as to where to
save the selected value of ddl1 so that I can use it when I rebuild my
controls (and repopulate ddl2).
I even tried running the BuildControls sub in my SelectIndexChanged event
since it runs after the LoadViewState sub and the controls exist at this
point. The problem then is I get 2 sets of the same controls. One set is
populated correctly and the 2nd has the original defaults.