<asp:RadioButton id=RadioButton1 runat="server" GroupName="Sl"></asp:RadioButton>
.......
<asp:RadioButton id=RadioButton4 runat="server" GroupName="Sl"></asp:RadioButton>当RadioButton单选选中时触发事件怎么写
我这样写有误?
<asp:RadioButton id=RadioButton1 runat="server" GroupName="Sl" onclick="s1_click"></asp:RadioButton>
......
asp:RadioButton id=RadioButton4 runat="server" GroupName="Sl" onclick="s1_click"></asp:RadioButton>
.cs文件中
protected void s1_click(object sender, ImageClickEventArgs e)
{
......
}
.......
<asp:RadioButton id=RadioButton4 runat="server" GroupName="Sl"></asp:RadioButton>当RadioButton单选选中时触发事件怎么写
我这样写有误?
<asp:RadioButton id=RadioButton1 runat="server" GroupName="Sl" onclick="s1_click"></asp:RadioButton>
......
asp:RadioButton id=RadioButton4 runat="server" GroupName="Sl" onclick="s1_click"></asp:RadioButton>
.cs文件中
protected void s1_click(object sender, ImageClickEventArgs e)
{
......
}
<asp:RadioButton id=RadioButton1 runat="server" GroupName="Sl" AutoPostBack="true" onclick="s1_click()"></asp:RadioButton>onclick()没起作用
<asp:RadioButton ID="RadioButton1" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged" />然后后台
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if(this.RadioButton1.Checked==true)
{
//你要做的事情
}
}如果你要是想用onclick的话写js吧。
比如:
<asp:RadioButton ID="RadioButton2" runat="server" onclick="javascript:alert('aaaaaaaa');" />
加上 autopostback这个属性
前台的控件应该是用 OnCheckedChanged 事件
<asp:RadioButton ID="RadioButton1" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged" />然后后台
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if(this.RadioButton1.Checked==true)
{
//你要做的事情
}
}
OnCheckedChanged="RadioButton1_CheckedChanged" AutoPostBack="true">但RadioButton1_CheckedChanged反应太慢
我想实现选中就相应事件
就是你选中那个RadioButton1,然后在属性窗口里
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
string id;
id = Request.QueryString["tt"].ToString();
if (this.RadioButton1.Checked == true)
{
this.RadioButton1.InputAttributes.Add("onclick", "parent.left.document.getElementById('" + id + "').innerText='A'");
}
}
多嘛?
我双击很快就执行to 10楼 我加了的
OnCheckedChanged="RadioButton1_CheckedChanged" AutoPostBack="true">但RadioButton1_CheckedChanged反应太慢
我想实现选中就相应事件