2015-04-02 68 views
0

的GridView RowDataBound事件我在控制與一直接鑄造爲如此閱讀...訪問的GridView的在編輯模式下的控制

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,I增加了兩個對照,另一個標籤和文本框,僅在編輯模式下。

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> 

好奇如何找到文本框。

回答

0

解決它......

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