1
我一直在尝试在C#中的RadioButtonList控件内输入文本框控件。下面是我一直这样做的方式,但我一直在试图收集文本框中的值,即使数据在文本框中,也总是传递空值。任何想法或建议?RadioButtonList嵌套文本框... C#
--aspx
<asp:RadioButtonList ID="rblContactMethod" runat="server" OnSelectedIndexChanged="rblContactMethod_OnSelectedIndexChanged" GroupName="grpContactMethod" AutoPostBack="True">
<asp:ListItem Value="All" Text="All">All</asp:ListItem>
<asp:ListItem Value="Range">Range: <input name="txtDateRange1" id="txtDateRange1" type="text" /> to <input name="txtDateRange2" id="txtDateRange2" type="text" /></asp:ListItem>
<asp:ListItem Value="Single" Text="SingleDate">Single Date: <input id="txtSingleDate" type="text" /></asp:ListItem>
</asp:RadioButtonList>
- aspx.cs 我甚至试过这样:
TextBox txt1 = FindControl("txtDateRange1") as TextBox;
TextBox txt2 = FindControl("txtDateRange2") as TextBox;
尝试增加RUNAT =“服务器”,以您的文本框 – dave823
现在我得到...分析器错误信息:的“文本”属性'asp:ListItem'不允许子对象。还有其他建议吗? – mrmcg