62,046
社区成员
发帖
与我相关
我的任务
分享
protected void cb_CheckedChanged(object sender, EventArgs e)
{
foreach (DataListItem item in dlProduct.Items)
{
//获取前台控件
CheckBox chkbox = item.FindControl("cb") as CheckBox;
Label lbId = item.FindControl("lblID") as Label;
//在这里想获取Div 获取到的不对
HtmlGenericControl div =item.FindControl("cainum") as HtmlGenericControl;
if (chkbox == null || lbId == null || div==null)
{
continue;
}
if (chkbox.Checked)
{
lbId.Text = "1";
div.Style["visibility"] = "visible";
div.Visible = true;
}
else
{
lbId.Text = "";
}
}
}