如何让客户段控件checbox选中 那要看你把你的数据放在什么控件里面吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //绑定子类 protected void dl_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { //绑定子类 CheckBoxList chk = (CheckBoxList)e.Item.FindControl("chklSub"); Label lblCountryID = (Label)e.Item.FindControl("lblCountryID"); string sql = @"select * from T_directory where Parentid = '" + lblCountryID.Text + "' order by DirNameChs"; DataSet ds = DbHelperSQL.Query(sql); chk.DataTextField = "DirNameChs"; chk.DataValueField = "directoryID"; chk.DataSource = ds; chk.DataBind(); //确定钩选 CustomSearchBLL Search = new CustomSearchBLL(); ds = Search.GetList("UserName='" + UserName + "' and CountryID='" + lblCountryID.Text + "'"); if (ds.Tables[0].Rows.Count > 0) { ((CheckBox)e.Item.FindControl("chklCountry")).Checked = true; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { foreach (ListItem Check in chk.Items) { if (Check.Value == ds.Tables[0].Rows[i]["SubID"].ToString()) { Check.Selected = true; } } } } } } 求正则(多行模式) 页面中无刷新弹出提示框? 字符串提取的问题,顺便给大家拜个年!!!!!! vs2005的安装错误!!!紧急求救!希望各位帮下忙!! WebService的问题 BC30205: 需要语句结束。 80分拜求前辈详细指点!该错误对网站致命!而我基础不好迫与尽快解决!!谢谢您!!! asp.net程序里提供网上发短信 屏蔽问题!!!!!!!!!!!!!!!!!!!!!!!! ASP.NET新手来求问,欢迎指点! 下载的源文件在VS新建的网站中没法打开啊 求一正则表达式 [请教]DropDownList问题
protected void dl_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
//绑定子类
CheckBoxList chk = (CheckBoxList)e.Item.FindControl("chklSub");
Label lblCountryID = (Label)e.Item.FindControl("lblCountryID");
string sql = @"select * from T_directory where Parentid = '" + lblCountryID.Text + "' order by DirNameChs";
DataSet ds = DbHelperSQL.Query(sql);
chk.DataTextField = "DirNameChs";
chk.DataValueField = "directoryID";
chk.DataSource = ds;
chk.DataBind();
//确定钩选
CustomSearchBLL Search = new CustomSearchBLL();
ds = Search.GetList("UserName='" + UserName + "' and CountryID='" + lblCountryID.Text + "'");
if (ds.Tables[0].Rows.Count > 0)
{
((CheckBox)e.Item.FindControl("chklCountry")).Checked = true;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
foreach (ListItem Check in chk.Items)
{
if (Check.Value == ds.Tables[0].Rows[i]["SubID"].ToString())
{
Check.Selected = true;
}
}
}
}
}
}