那要看你把你的数据放在什么控件里面吧
解决方案 »
- 页面布局问题
- 关于密码验证的问题~
- |M| SQL更新ACCESS语句:insert into shoptatil1(userid,productid,count,buytime) select userid,productid,sum(count),'{0}' from shopt
- 打开项目与新建项目
- 判断数据库记录有重复??
- 使用过web用户控件的进来!!!使用web自定义控件提示:分析器错误!
- ajax页面中可以使用asp.net的服务器端控件么?
- 关于 文件读写 的简单问题请教
- 有谁可以帮忙给些建议?我们的.net图片网站运行很慢
- 江雨,思归兄:问你们一个问题?
- 求一正则表达式
- [请教]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;
}
}
}
}
}
}