你的label是有规律的吗?比如label1、label2这样的。
而赋值就比较简单了阿。label1.Text = CheckBoxList.SelectIndex.Value;
而赋值就比较简单了阿。label1.Text = CheckBoxList.SelectIndex.Value;
解决方案 »
- MVC 不支持对于视图进行分页吗?
- asp.net和autocad
- 如何使用网络解决问题?-----不一定马上须要baidu/google.
- 使用XMLhttp 访问Asp.Net Forums的论坛 登陆状态的问题
- 求这段代码的意思
- 空记录时,如何显示网页上DataGrid的标题栏呢?我在用DataGrid时,没有记录就完全不显示出来的,还请大虾们指点指点
- 嘿嘿,各位帮帮忙咯,小的不胜感激 。实现汽车查询修改。
- 无法启动程序 "http://localhost:6398/cc/Default.aspx" 系统找不到指定的文件
- 在datagrid中的页脚中有两个dropdownlist(连接数据库中的两个表),我想一个dropdownlist控制另外一个dropdownlist中的数据怎么实现?
- 用户控件中控件属性的实现?
- Sybase sql语句不支持@????顶有分
- 好人帮忙,没分了
{
label1.text = check1.values;
}
if(CheckBoxList1.Items[2].Selected)
{
label2.text = check2.values;
}
function sendValue(myCheckBoxListId)
{
document.getElementById("myLabel").value = document.getElementById(myCheckBoxListId).value;
}楼主根据实际情况稍加改动,动态生成的控件也好,多选赋值也罢,都能很轻松实现的.
{
string[] aa=new string[10];
if (CheckBoxList1.Items[i].Selected)
{
Label1.Text += CheckBoxList1.Items[i].Text + ",";
aa[i]=CheckBoxList1.Items[i].Text
}
}
我现在是这么取的,把选出来的值都复值到aa这个数组里了。咋给他帮到label里面啊
{
if(checkbox.Selected)
{
this.Label1.Text = checkbox.Value;
}
}
{
if(checkbox.Selected)
{
this.Label1.Text = checkbox.Value;
}
}
这样只是复值给Label1了。我想点第2次的时候复值第二个Label
--------------------------
用switch...case做个判断不就行了吗?
我现在脑子很乱一点思路都没有,你给简单写一下,谢谢
{
if(checkbox.Selected)
{
switch(checkbox.Value)
{
case "1":
this.Label1.Text = checkbox.Value;
case "2":
this.Label2.Text = checkbox.Value
......
}
}
}
把所有的Label放在一个容器里面 比如Panel吧
int index=0;
foreach(ListItem checkbox in this.CheckBoxList1.Items)
{
if(checkbox.Checked)
{
((Label)Panel.Controls[index++]).Text=checkbox.Value;
index++;
}
}
是这个思路 你在试一试吧