views:

178

answers:

2

Hi Everyone,

Any suggestions on how I would create a radio button list with an option for the user to input free text?

Here's a quick sample of what i'd be looking for:

  • Red
  • Blue
  • Green
  • Other (textbox would go here)
+1  A: 

You could just have a Radio Button list and then when Other is selected in the event set the text box enabled otherwise disable it if it isn't the Other button.

Adam Gritt
+1  A: 

Have a look at

Something like this

<asp:RadioButtonList ID="rdo" Runat="server">
    <asp:ListItem>First</asp:ListItem>
    <asp:ListItem>Second</asp:ListItem>
    <asp:ListItem>Others <input type="text" name="txtOthers"></asp:ListItem>
</asp:RadioButtonList>
astander
Having just looked at this, the above mark-up will not work when using a server-side tag. You'll get a Parser error: "The 'Text' property of 'asp:ListItem' does not allow child objects."
PabloC