我目前调用客户端函数和服务器端函数从同一按钮单击因此…
<asp:Button id="myButton"
runat="server"
cssclass="myButtonClass"
text="Do Stuff"
onclick="Do_Foo"
OnClientClick="Do_Bar();"/>
我想知道是否有类似的东西可以用于单选按钮列表…
<asp:RadioButtonList id="myRadioButtonList"
runat="server"
AutoPostBack="True"
onselectedindexchanged="Do_Fum"
...er...something here?>
<asp:ListItem ...or here perhaps?... Value="0">First Button</asp:ListItem>
.
.
您可以使用以下方法:在页面的Page_PreRender
事件处理程序中粘贴下面的代码
foreach (ListItem item in myRadioButtonList.Items)
{
item.Attributes["onclick"] = "if(!confirm('Are you sure?'))return false";
}
你可以在javascript中像
这样将一个更改事件挂接到单选按钮上$('#myRadioButtonList').change(function() {
alert('Handle Your Change');
});