【问题标题】:Access TextBox Control In ListView Control在 ListView 控件中访问 TextBox 控件
【发布时间】:2015-08-13 17:26:06
【问题描述】:

如何访问“ListView”控件中的“TextBox”控件?

例如我想在代码隐藏中使用this.AddCommentTextbox.Text 属性。

aspx代码:

 <asp:ListView ID="PostsListView" runat="server" DataSourceID="EntityDataSourcePosts">
   <ItemTemplate>
     <asp:TextBox Text="active" ID="AddCommentTextbox" runat="server"  TextMode="MultiLine" Height="100" Width="370"></asp:TextBox>
   </ItemTemplate>
 </asp:ListView> 

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    你可以试试这样的:

    TextBox tmpControl = (TextBox)PostsListView.FindControl("AddCommentTextbox");
    

    然后你可以用 tmpControl.text 做一些事情

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      相关资源
      最近更新 更多