[英]Cannot fire runtime radiobutton checkedchanged event inside linkbutton click event
[英]About RadioButton CheckedChanged event
嗨,我使用一个TextBox查询不同类型的选择,例如,当我选择第一个RadioButton(姓氏)时,我按客户端姓氏搜索;当我选择第二个RadioButton(文档名)时,我按代码搜索,依此类推,例如,如果用户选择“按日期搜索”并发送字符串类型,请问如何管理或处理异常?
我正在使用C#3.5-Asp.net
我想使用正则表达式添加它,并将其添加到RadioButton事件中,因此,当用户更改单选按钮时,他可以在optionA中仅键入一些字符,在Option B中键入其他字符,并在OptionC中键入日期...(正则表达式)
预先感谢
如果您使用的是ASP Web控件单选按钮列表,那么当它们是回发时,您可以进行很多更改。 您可以将属性设置为SelectIndexChanged,因此只要它们的更改会导致回发,然后您就可以从其验证中进行任何操作。 例如:
<asp:radioButtonList
id="radio1" runat="server"
autoPostBack="true"
cellSpacing="20"
repeatColumns="3"
repeatDirection="horizontal"
RepeatLayout="table"
textAlign="right"
OnSelectedIndexChanged="radio_SelectedIndexChanged">
<asp:ListItem text="10pt" value="itsMe"/>
<asp:ListItem text="14pt" value="itsYou"/>
<asp:ListItem text="16pt" value="Neither"/>
</asp:radioButtonList>
在您应该拥有的服务器上
protected void radio_SelectedIndexChanged(object sender, EventArgs e)
{
//do whatever you want by calling the name of the radio id
//example
if(radio1.SelectedItem.Value=="(whatever you want to test)"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.