3

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

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

asp代码:

 <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> 
4

1 回答 1

4

你可以尝试这样的事情:

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

然后你可以用 tmpControl.text 做点什么

希望有帮助。

于 2013-02-24T20:53:29.823 回答