Last post Mar 29, 2010 01:48 PM by FlyingAce
Mar 18, 2010 12:54 PM|FlyingAce|LINK
I am trying to come up with a server control that displays a grid of option buttons with a corresponding question/statement for each set of multiple option buttons. This will be used in a larger web survey.
Most of the examples I have come across create classes derived from Control or WebControl whose overridden Render method uses the HTMLTextWriter to spit out regular HTML with the Write method.
How would I go about, on the page submission at the end of the survey, collect the answers? Would I have to set the UniqueID, then loop through the page Control collection and pull out just those option values?
Thank you in advance,
Mar 29, 2010 01:48 PM|FlyingAce|LINK
How the control works is as such, at runtime,: 1)The user specifies a TopStatement, 2) The user specifies a list of OptionHeadings, 3) The user specifies a list of OptionStatements, 4) The user specifies a list of OptionValues. These are all properties that
are kept in the Page's ViewState.
In my virtual Render method I am constructing an ID for a HtmlInputRadioButton based on the ControlPrefix property, row number, and column number. The control's value corresponds with the OptionValue List of strings. For instance, if the third OptionHeading
happens to be "Satisfied" and the third OptionValue happens to be 2 and the ninth OptionStatement is "9.) Your overall experience with...", the render method creates a radio button as such:
The problem having is that I can't get the values for the selected radio buttons once a submit button is clicked. I have tried to recursively loop through all of the controls on the web form, no joy, and I have tried to use the Form NameValueCollection,
again, no joy.
Does anyone have any idea on how to accomplish getting the selected values from this Custom Server Control?
Again, thanks in advance,