【问题标题】:Accessing a control of Gridview in Edit mode在编辑模式下访问 Gridview 的控件
【发布时间】:2015-04-02 14:41:22
【问题描述】:

Gridview RowDataBound 事件我正在使用直接强制转换的控件中读取...

Dim transTB As TextBox = DirectCast(e.Row.Cells(3).Controls(1), TextBox)
Dim engLabel As Label = DirectCast(e.Row.Cells(2).Controls(1), Label)

在第二列,单元格 2 中,我添加了另外两个控件,另一个标签和文本框,仅在编辑模式下。

Dim newTB6 As TextBox = DirectCast(e.Row.Cells(2).Controls(2), TextBox)

我正在尝试使用上述演员阵容进入新的文本框 newTB6。我找不到它。

这是内联...

<EditItemTemplate>
   <asp:Label ID="Label1" runat="server" Text='<%# EncodeIT(Eval("shrt_Txt")) %>'></asp:Label><br /><br />
   <asp:Label ID="Label13" runat="server" Text="Train"></asp:Label>
     <br />
    <asp:TextBox ID="TextBox6" runat="server" Width="400px" Text='<%# Eval("lan_Strg") %>'></asp:TextBox>
</EditItemTemplate>

很好奇如何找到文本框。

【问题讨论】:

    标签: asp.net vb.net gridview


    【解决方案1】:

    解决了...

    Dim newTB6 As TextBox = DirectCast(e.Row.Cells(2).Controls(2).FindControl("Textbox6"), TextBox)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      • 2014-10-04
      • 1970-01-01
      • 2011-07-04
      • 2012-12-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多