在ListView控件中访问TextBox控件

3
如何访问“ListView”控件内的“TextBox”控件?
例如,我想在代码后端中使用此.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> 
1个回答

4
你可以尝试像这样做:

你可以尝试像这样做:

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

然后您可以对 tmpControl.text 进行一些操作。

希望这有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接