private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.EditItem)
{ CheckBoxList CBList= (CheckBoxList)e.Item.FindControl("CBLPopedom");
String PopedomValue = DataBinder.Eval(e.Item.DataItem, "adminPopedom").ToString();
string [] Popedom=null;
if (PopedomValue!=null)
Popedom=PopedomValue.Split(null);
if (PopedomValue!=null)
{
for (int i=0;i<Popedom.Length;i++)
((CheckBoxList)e.Item.FindControl("CBLPopedom")).Items.FindByText(Popedom[i]).Selected=true;
}
DataGridBind();
}
}
{
if(e.Item.ItemType == ListItemType.EditItem)
{ CheckBoxList CBList= (CheckBoxList)e.Item.FindControl("CBLPopedom");
String PopedomValue = DataBinder.Eval(e.Item.DataItem, "adminPopedom").ToString();
string [] Popedom=null;
if (PopedomValue!=null)
Popedom=PopedomValue.Split(null);
if (PopedomValue!=null)
{
for (int i=0;i<Popedom.Length;i++)
((CheckBoxList)e.Item.FindControl("CBLPopedom")).Items.FindByText(Popedom[i]).Selected=true;
}
DataGridBind();
}
}
解决方案 »
- [疑难杂症] 如何能将当前页面的内容保存成HTML文件放到服务器上???难。。。难。。。难。。。
- IIS服务器的配置问题
- 请教一个关于Infragistics的WebMonthView的问题
- ++++++++++再问怎样获得GridView单元格的值,或在javascript取得值后怎样传递给c#后台?
- vs2012工具箱里的常规控件是空的 重置也没有
- 有谁知道asp.net共支持哪几种脚本语言?比如vbscript就是一种
- 还是水晶报表
- 我在本机开发的asp.net,用的是本机的数据库开发的,会不会产生以下问题?
- mysql UNION 的问题,这语句错误,真的不明白
- vs.net的帮助中提到每个控件的系统平台要求,如果没有w98,是否还可以在98下运行?需要做哪些工作?谢谢!!
- 急急急急急!!!!在线等待!!!!!
- ASP.NET高手帮忙,在线等待
你看一下这里
初始化变量不能为null换个值试试
那么你得到的
CBList有可能为null
在下面用它就 “未将对象引用设置到对象的实例”了
应该在FindControl后
xxx zz= y.Findcontrol("zz");
if(zz!=null)
{
//做你的事情
}
那么比如你得到的
CBList有可能为null
在下面用它就 “未将对象引用设置到对象的实例”了
应该在FindControl后
xxx zz= y.Findcontrol("zz");
if(zz!=null)
{
//做你的事情
}