I'm sure this has been answered but I cannot find it...perhaps because the terms are used for so many differing questions...anyway.
how is the best way to store information about building dynamic controls on postback etc in the init event...
e.g. take the classic "questionnaire" scenario...question.aspx?id=1
- get the id from the querystring
- load the questions from where ever and build controls dynamically, or dynamically add each question user control for how ever many questions etc
- page posts back (user presses submit I guess!)
- in the init event...where should you have already stored the id to recreate the question controls?
things i've tried/thought of so far:
- I initially stored the value in viewstate as it's relevant to the page, but the viewstate value isn't available in page init (or is it??)
- a hidden variable and then accessing the value in the form collection
- session - I don't want to use session, seems problematic, e.g. what if the user views two questionnaires?
- the querystring again? but that seems too easy to be changed and the dynamic controls just wouldn't make sense...
- in the controls themselves? e.g. disregard the questionnaire id all together and simply go off the question id perhaps?? assuming that control ids would be in some format like controlQ# e.g. controlQ1, controlQ2. this means that each question id must be unique
any help/guidance etc much appreciated!!!