View Full Version : [CLOSED] Read Value from Dynamically Generated Radio Group

Oct 11, 2013, 2:26 PM
I have a dynamically generated form working off of questions in a database. Here's how the radio group/options are generated.

if (question.QuestionType.TypeName == "radio"){
ext.RadioGroup RadioGroup = new ext.RadioGroup()
ID = "q" + question.FormQuestionID.ToString(),
FieldLabel = question.QuestionText,
LabelAlign = ext.LabelAlign.Top,
MaxWidth = 400,
List<QuestionOption> Options = (from o in MyConn.QuestionOption
where question.FormQuestionID == o.FormQuestionId
select o).ToList();
foreach (QuestionOption o in Options)
RadioGroup.Items.Add(new ext.Radio()
ID= "o" + o.QuestionOptionId.ToString(),
BoxLabel = o.OptionName,
Value = o.QuestionOptionId.ToString(),
MaxWidth = 50,
Padding = 5,
Margin = 5


After the form is filled out, in PageLoad I regenerate the form, and then the Click Handler for the Submit Button fires. Here's how I iterate through the response if it's a radio button.

if (question.TypeName == "radio")
FormAnswer Answer = new FormAnswer{
FormQuestionID = question.FormQuestionID,
Answer = Request["q" + question.FormQuestionID]

For text, textarea, datepicker, and dropdown fields, the responses are captured and saved to the database properly. For the radio buttons, the Request["q" + question.FormQuestionID] is null.

I also tried

ext.X.GetCmp<ext.RadioGroup>("q" + question.FormQuestionID).CheckedItems[0].Value.ToString()
and receive an Invalid cast exception on CheckedItems

Oct 11, 2013, 3:24 PM
I got the radio values by following


Is the same true for CheckBoxes?

Oct 11, 2013, 3:39 PM
Hi @ljankowski,

Is the same true for CheckBoxes?

Yes, I think it is the same with CheckboxGroup.