我按照此示例http://www.codeproject.com/KB/webforms/Editable_GridView.aspx構建可編輯的GridView控件。 我有這樣的代碼在我的GridView:在RowDataBound事件中找不到下拉列表
<asp:TemplateField HeaderText="Negócio">
<ItemTemplate>
<asp:Label ID="lblNegocio" runat="server" Text='<%# Eval("Negocio") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlNegocio" runat="server" />
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlNewNegocio" runat="server" />
</FooterTemplate>
現在,我試圖填補EditItemTemplate中的下拉菜單,也是同樣的例子說,一些動態值,在網格的RowDataBound事件。但是,當我這樣做,FindControl方法總是返回Nothing:
Protected Sub gdvRegraRotationDefault_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gdvRegraRotationDefault.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim ddlNegocio As DropDownList = e.Row.FindControl("ddlNegocio")
End If
末次
如果我不能找到下拉我不能加載它的價值,當我要去編輯de條目它將是空的。
有人可以幫助我嗎?
謝謝(:
非常感謝。(: – gabsferreira 2011-12-20 10:48:21
歡迎您! – AGuyCalledGerald 2011-12-20 10:50:28