ASP.NET jQuery 随笔 显示RadioButtonList成员选中的内容和值
2013-12-12 15:14
776 查看
通过jQuery来获取RadioButtonList成员内容。
[code]
[/code]
<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="Web.Default"%>
[code]
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
<scriptsrc="jquery-1.8.2.min.js"type="text/javascript"></script>
<linkhref="Base.css"rel="stylesheet"type="text/css"/>
<styletype="text/css">
</style>
<scripttype="text/javascript">
$(document).ready(function(){
$("#<%=rblHobbies.ClientID%>input[type=radio]").bind("change",function(){
if($(this).val()!=""){
$("#message").text("Text:"+$(this).next().text()+"Value:"+$(this).val());
}
});
});
</script>
</head>
<body>
<formid="form1"runat="server">
<divstyle="margin:100pxauto;width:400px;height:200px;">
<fieldsetstyle="width:400px;height:150px">
<p>
请选择爱好</p>
<asp:RadioButtonListID="rblHobbies"runat="server">
<asp:ListItemValue="1">音乐</asp:ListItem>
<asp:ListItemValue="2">篮球</asp:ListItem>
<asp:ListItemValue="3">美剧</asp:ListItem>
<asp:ListItemValue="4">电影</asp:ListItem>
</asp:RadioButtonList>
</fieldset>
<br/>
<divid="message"style="color:blue;"></div>
</div>
</form>
</body>
</html>
[/code]
相关文章推荐
- asp.net使用jQuery获取RadioButtonList成员选中内容和值示例
- asp.net使用jQuery获取RadioButtonList成员选中内容和值示例
- ASP.NET jQuery 随笔 显示CheckBoxList成员选中的内容
- ASP.NET jQuery 食谱5 (显示CheckBoxList成员选中的内容)
- ASP.NET jQuery 实例5 (显示CheckBoxList成员选中的内容)
- ASP.NET jQuery 实例5 (显示CheckBoxList成员选中的内容)
- ASP.NET jQuery 实例16 通过控件CustomValidator验证RadioButtonList
- asp.net绑定radiobuttonlist--------jquery绑定click事件,获取radio的value和显示值
- ASP.NET中读取Excel内容,并显示在界面上
- asp.net控件开发(一)-显示控件内容
- Jquery 取RadioButtonList选定项的值及显示的数据
- [ASP.NET MVC]为HtmlHelper添加一个RadioButtonList扩展方法
- ASP.NET控件之RadioButtonList
- ASP.NET MVC Bootstrap模板选中菜单高亮显示当前项方法
- ASP.NET jQuery 食谱6 (实现CheckBoxList成员全选或全取消)
- asp.net的多行TextBox随内容增加自动增高而不显示滚动条!
- ASP.NET MVC入门教程(三)文章评论内容的加载与显示
- ASP.NET FormView中编辑时的RadioButtonList控件报错,找不到匹配的Value
- ASP.NET中读取Excel内容,并显示在界面上
- 在ASP.NET中显示XML内容(以常见的公告栏为例)