Reputation:
I'm trying to set a value from the database into a Html component, the code is as follow:
<asp:RadioButtonList ID="rbFiltroCostesPre" runat="server" AutoPostBack="false" Width="286px">
<asp:ListItem Selected="True" Value="A">All</asp:ListItem>
<asp:ListItem Value="Greater">First 10</asp:ListItem>
<asp:ListItem Value="GreaterThan">Greater than: <input ID="txtGreaterThan" type="text" ></asp:ListItem>
</asp:RadioButtonList>
The last ListItem has a Html tag inside, like:
<input id="txtGreaterThan" type="text"/>
, which has been transform by the Visual Web Development IDE.
Can I set it's value dynamically from the codebehind? Thx.
Upvotes: 0
Views: 761
Reputation: 8098
Sorry, but you can't do that with the managed ListItem control. What's happening in your page is it's setting the Text
value of your ListItem with Greater than: <input ID="txtGreaterThan" type="text" >
.
What you could do is to use a RadioButton instead of a RadioButtonList
and place a TextBox
control next to the RadioButton. This would allow you to access it server-side.
Upvotes: 1