字符串中的复选框值 [英] checkbox value in string
本文介绍了字符串中的复选框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
for (int itemcount = 0; itemcount < Rpt_Company.Items.Count; itemcount++)
{
CheckBox chkbox = ((CheckBox)Rpt_Company.Items[itemcount].FindControl("chkbox"));
if (chkbox != null && chkbox.Checked == true)
{
// memberno += chkbox.Text;
//memberno += (chkbox.Text + "<br />");
Literal lbl = (Literal)Rpt_Company.Items[itemcount].FindControl("chkbox");
string lblid;
lblid = lbl.Text;
}
}
选定的复选框值将以字符串或标签的形式接收...帮助我
selected checkbox value to be received in a string or label...help me
推荐答案
在ur类中声明一个字符串
字符串chkVal;
设置checkbox_CheckChanged事件为复选框,放置如下内容
Declare a string in ur class
string chkVal;
set checkbox_CheckChanged event for the checkbox put something like following
private void checkbox1_CheckChanged(object sender,EventArgs e)
{
if(checkbox1.Checked)
{
chkVal=checkbox1.Text;
}
else
{
chkVal="";
}
}
祝你好运……
Best of luck......
这篇关于字符串中的复选框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文