当前位置: 代码迷 >> ASP.NET >> 小弟我是初学者,请问有关问题
  详细解决方案

小弟我是初学者,请问有关问题

热度:8792   发布时间:2013-02-25 00:00:00.0
我是菜鸟,请教问题
各位高手好,小弟现在用ASP.NET做后台权限,现在有个问题
权限那块我有4个部门,分别为客服部,业务部,运营部,财务部,我分别用4个复选框(CheckBox),我要怎么做才能实现我是不是选中了部门后插入数据库,然后数据库里的相应的字段值为1

------解决方案--------------------------------------------------------
for (int i = 0; i < 4; i++)
{
int temp = i + 1;
string strname = "CheckBox" + temp.ToString();
CheckBox chb = (CheckBox)Page.FindControl(strname);
if (chb.Checked == true)
{
diction = diction + "1" + "|";

}
else if (chb.Checked == false)
{

diction = diction + "0" + "|";
}
}

 int strlen = diction.Length;
diction = diction.Substring(0,strlen-1);
  相关解决方案