如何在网格视图的页脚中找到DropDownList [英] how find DropDownList in footer of my grid view
本文介绍了如何在网格视图的页脚中找到DropDownList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页脚中有DropDownList,我想找到我的下拉列表来绑定它我得到错误对象引用未设置为对象的实例。我尝试在RowDataBound事件中绑定它
这是我的代码
DropDownList drp_pmm = gv_pm.FooterRow.FindControl(drp_pmm)as DropDownList;
i have DropDownList in footer whene i want to find my drop down list to bind it i get error Object reference not set to an instance of an object. i try to bind it in RowDataBound event
this is my code
DropDownList drp_pmm = gv_pm.FooterRow.FindControl("drp_pmm") as DropDownList;
<FooterTemplate>
<asp:DropDownList ID="drp_pmm" runat="server"></asp:DropDownList>
</FooterTemplate>
推荐答案
RowDataBound
事件太早了 -GridView
在创建所有行并进行数据绑定之前,不会创建其页脚行。
尝试网格的DataBound
事件代替。
TheRowDataBound
event is too early - theGridView
doesn't create its footer row until all rows have been created and data-bound.
Try the grid'sDataBound
event instead.
这篇关于如何在网格视图的页脚中找到DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文