foreach (DataListItem dl in DataList1.Items)
调试时,到这里抛出异常了,
CheckBox chk2;
public void checkMenuID()
{
int id = Convert.ToInt32(Request["idd"]);
var linq = (from b in dc.VM_CON_Article
where b.ArticleID == id
select b).FirstOrDefault();
if (linq.ArticleShare == "")
{
bindName();
//ShareMenu();
}
else
{
string[] powerList = linq.ArticleShare.Split(',');
if (powerList.ToString() != null)
{
int num = linq.ArticleShare.Split(',').Length;
for (int i = 0; i < num; i++)
{
try
{
int lu = Convert.ToInt32(powerList[i]);
if (lu == 0)
{
return;
}
else
{
var sQuery = (from t in dc.VM_SYS_Menu
where t.MenuID == lu
select t).FirstOrDefault();
foreach (DataListItem dl in DataList1.Items)
{
chk2 = (CheckBox)(dl.FindControl("cbCheck"));
if (chk2 != null)
{
chk2.Text = sQuery.MenuName;
chk2.ID = powerList[i];
}
foreach (string item in powerList)
{
if (item == null)
{
chk2.Checked = false;
}
else if (item == powerList[i])
{
chk2.Checked = true;
}
else
{
bindName();
ShareMenu();
}
}
}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货