include a textbox within a radiobuttonlist item

G

Guest

Is it possible to include a textbox control inside of a radiobuttonlist item? Below is my attempt, but didn't work. when i say "didn't work"... it did not get an error message, but the textbox was not displayed. The code snippet represents what is inside of a loop that is building the survey form. Any thoughts

//adding the radiobuttonlist listitem her
ListItem li = new ListItem()
li.Value = AryAnswers[j,1]
li.Text = AryAnswers[j,2]
rbl.Items.Add(li)

//any additional controls
//here is where i check an array value... if it has a value, that mean
//I need to add a child control. for example, the is a survey form and mos
//answers are simply radio buttons, but sometimes the survey user may nee
//to select a radio button such as "Other.....[textbox here]
if (AryAnswers[j,3] != null && AryAnswers[j,3] != ""

string ControlName = AryAnswers[j,3]
switch (ControlName.Substring(0,3)

case "Txt"
TextBox txt = new TextBox()
txt.ID = ControlName
rbl.Controls.Add(txt)
break


PhQuestions.Controls.Add(rbl)
 
B

Brian Newtz

Derive a custom radio button and add the Value property...

-Brian

mdengler said:
I was able to do exactly what I need by using the RadioButton control
instead of RadioButtonList. Now my question is... Is it possible to define
a value for a radiobutton? I see a "text" property, but no "value".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top