GridView绑定DropDownList的小问题
2007-11-27 16:25
357 查看
在点GridView的编辑按钮时候 对DropDownList的数据进行绑定.
DropDownList所在的列是摸板列,
在RowEditing事件下如下源码
DropDownList ddl = this.GridViewMemberAccount.Rows[e.NewEditIndex].Cells[0].Controls[1] as DropDownList;
DropDownListHelper.BindMember(ddl);
this.GridViewMemberAccount.EditIndex = e.NewEditIndex;
this.GridViewDataBind();
这样会报错,提示未将对象引用到对象的实例 找不到dropDownList
要先绑定GridView的数据再绑定DropDownList.
this.GridViewMemberAccount.EditIndex = e.NewEditIndex;
this.GridViewDataBind();
DropDownList ddl = this.GridViewMemberAccount.Rows[e.NewEditIndex].Cells[0].Controls[1] as DropDownList;
DropDownListHelper.BindMember(ddl);
但原因不 明, 不知道是不是没绑定数据前 控件是未被实例化?
DropDownList所在的列是摸板列,
在RowEditing事件下如下源码
DropDownList ddl = this.GridViewMemberAccount.Rows[e.NewEditIndex].Cells[0].Controls[1] as DropDownList;
DropDownListHelper.BindMember(ddl);
this.GridViewMemberAccount.EditIndex = e.NewEditIndex;
this.GridViewDataBind();
这样会报错,提示未将对象引用到对象的实例 找不到dropDownList
要先绑定GridView的数据再绑定DropDownList.
this.GridViewMemberAccount.EditIndex = e.NewEditIndex;
this.GridViewDataBind();
DropDownList ddl = this.GridViewMemberAccount.Rows[e.NewEditIndex].Cells[0].Controls[1] as DropDownList;
DropDownListHelper.BindMember(ddl);
但原因不 明, 不知道是不是没绑定数据前 控件是未被实例化?
相关文章推荐
- Gridview中数据绑定Dropdownlist 组件默认值为空null的问题
- GridView绑定DropDownList的小问题
- 关于Dropdownlist绑定GridView分页出错问题
- GridView分页和通过DropDownList筛选的问题
- ASP.NET 2.0的 GridView中模板列绑定DropDownList的数据处理
- 向GridView的模板列绑定OnClientClick的函数时出现了奇怪的问题
- 在ascx中使用DropDownList绑定数据页面刷新时变空的问题
- GridView应用实例(包括添加、删除、更新以及DropDownList的绑定)转
- 关于.net中的dropdownlist控件绑定hashtable和时间控件选择问题
- GridView绑定DropdownList
- 复杂自定义数据对象绑定到GridView的问题
- 数据绑定控件收藏 DropDownList ListBox GridView DataList Repeater FormView DetailsView
- GridView中DropDownList的选中值的问题
- Castle ActiveRecord 在GridView数据绑定时候的一个问题
- DropDownList绑定出现控件中显示的是“System.Data.DataRowView”问题记录
- DropDownList数据绑定及添加默认项的问题
- [网络收集]dropdownlist绑定的二种方法及 在gridview等控件中绑定dropdownlist的简单方法
- DropDownList绑定显示问题! ——转
- 每日学习总结:DataTable按某一列数值大小排序问题、GridView后台动态绑定、页面导航方法总结
- gridview行编辑时绑定Dropdownlist并选中对应值