或是给CheckBoxList的每项都添加一个OnClick事件,点击后传当前选择项的值也行。SelectedValue和SelectedItem.Value都只能得到最靠前的选择项的值。
解决方案 »
- 请教各位高手,我自制的一个网页文本编辑器,内容用seesion保存,输出在一个页面中,在ie6下编辑正常,但在ie7,ie8下,编辑的时候内空会消失一下。
- |zyciis| NHibernate 如何查询exists另一个实体,谢谢 有代码
- 超连接
- 怎样让一个文本框只能输入数字,限制位数?
- webform 中datagrid的超级链接列传值问题?郁闷以上午了.....
- 如何解决DataGrid弹出窗口,不要父窗口关闭.像csdn这种效果
- this.Response.Redirect("http://tom.com");能否在新窗口打开网页
- 关于HTML长度的问题,比较困扰。
- 自定义工具"MSDiscocodegenerator"失败,未能检索当前项目
- 求助,通过什么方法可以实现在后台改变前台显示的图片
- 控件加载事件继续请教各位大侠
- 一个模板列的问题
<title>无标题页</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(){
var result=new Array();
$(":checkbox").each(function(){
if($(this).attr("checked"))
result.push($(this).next().html());
})
alert(result);
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a>获取</a>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Value="22">22</asp:ListItem>
<asp:ListItem Value="33">33</asp:ListItem>
<asp:ListItem Value="44">44</asp:ListItem>
</asp:CheckBoxList>
</div>
</form>
</body>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Value="22">22</asp:ListItem>
<asp:ListItem Value="33">33</asp:ListItem>
<asp:ListItem Value="44">44</asp:ListItem>
</asp:CheckBoxList>
protected void Button1_Click(object sender, EventArgs e)
{
string result = "";
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
result += CheckBoxList1.Items[i].Value + ",";
}
Response.Write(result);
}
{
if (li.Selected)
{}
}
<title>无标题页</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var result = new Array();
$(":checkbox").click(function(){
result.push($(this).next().html());
})
$("a").click(function(){
alert(result[result.length-1])
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a>获取</a>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Value="22">22</asp:ListItem>
<asp:ListItem Value="33">33</asp:ListItem>
<asp:ListItem Value="44">44</asp:ListItem>
</asp:CheckBoxList>
</div>
</form>
</body>
var result = new Array();
$("#CheckBoxList1 :checkbox").each(function () {
$(this).click(function () {
alert($(this).val());
});
});
})