【发布时间】:2012-01-24 06:53:54
【问题描述】:
我正在按照这个示例http://www.codeproject.com/KB/webforms/Editable_GridView.aspx 构建一个可编辑的 GridView 控件。 我的 GridView 中有这段代码:
<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>
现在,正如示例所述,我正在尝试在网格的 RowDataBound 事件中使用一些动态值填充 EditItemTemplate 中的下拉列表。但是当我这样做时,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 条目时,它将为空。
有人可以帮我吗?
谢谢(:
【问题讨论】: