B
brad
Group,
I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which
contains nested server user controls in order to create a tree-like
hierarchy.
The tree is a sort of question and answer dialog. The user answers a
question, and the next subquestion appears (using dynamic html
display:none|block) depending on his answer.
When all the questions are answered, the webform is posted.
Based on my reading, I understand that I have to recreate the nested
control structure in the OnInit event before the postback data is
applied to my dynamic server controls.
So, I grab my "active" question from the Session state and proceed to
rebuild my tree of controls using a method, appropriately named,
createDynamicControls.
I have verified at the end of the OnInit that the hierarchy is rebuilt
and I'm trusting the IDs to be created the same way, seeing how the
same method is used to always recreate the heirarchy.
Now, I *believe* after the init event, ASP.NET is supposed "fill-in"
the selected values in the form and then fire the page_load events for
the controls. Is this true? Because...
When I inspect my nested control tree in page_load, the state of my
radio buttons is not changed.
Architecturally, I have two custom System.Web.UI.UserControls:
QuestionManager
QuestionItem
QuestionManager has a placeholder on which QuestionItems are arranged.
QuestionItem contains two server controls:
A label for the question text
A placeholder for the answers
Answers are Radiobutton lists of possible answers. For each answer
(radio button list item), there may be a further subquestions.
If there are answer-dependent sub-questions, QuestionItems are created
for them and they are added to the parent answer placeholder
(display:none) and the display is manipulated on the client in
javascript based on the selected answer.
The tree displays nicely on the client, they can select radio buttons,
the appropriate subquestions become visible and life seems good.
--Until the postback.
A. is this a stupid architecture?
B. can it ever work?
C. why doesn't it work? i.e. why are the altered radiobuttons not
ready for me in page_load?
Thanks in advance,
Sorry if this is a newbie question on the wrong group; if it is kindly
redirect me to the appropriate group.
Brad
I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which
contains nested server user controls in order to create a tree-like
hierarchy.
The tree is a sort of question and answer dialog. The user answers a
question, and the next subquestion appears (using dynamic html
display:none|block) depending on his answer.
When all the questions are answered, the webform is posted.
Based on my reading, I understand that I have to recreate the nested
control structure in the OnInit event before the postback data is
applied to my dynamic server controls.
So, I grab my "active" question from the Session state and proceed to
rebuild my tree of controls using a method, appropriately named,
createDynamicControls.
I have verified at the end of the OnInit that the hierarchy is rebuilt
and I'm trusting the IDs to be created the same way, seeing how the
same method is used to always recreate the heirarchy.
Now, I *believe* after the init event, ASP.NET is supposed "fill-in"
the selected values in the form and then fire the page_load events for
the controls. Is this true? Because...
When I inspect my nested control tree in page_load, the state of my
radio buttons is not changed.
Architecturally, I have two custom System.Web.UI.UserControls:
QuestionManager
QuestionItem
QuestionManager has a placeholder on which QuestionItems are arranged.
QuestionItem contains two server controls:
A label for the question text
A placeholder for the answers
Answers are Radiobutton lists of possible answers. For each answer
(radio button list item), there may be a further subquestions.
If there are answer-dependent sub-questions, QuestionItems are created
for them and they are added to the parent answer placeholder
(display:none) and the display is manipulated on the client in
javascript based on the selected answer.
The tree displays nicely on the client, they can select radio buttons,
the appropriate subquestions become visible and life seems good.
--Until the postback.
A. is this a stupid architecture?
B. can it ever work?
C. why doesn't it work? i.e. why are the altered radiobuttons not
ready for me in page_load?
Thanks in advance,
Sorry if this is a newbie question on the wrong group; if it is kindly
redirect me to the appropriate group.
Brad