访问TextBox控件在ListView控件 [英] Access TextBox Control In ListView Control

查看:116
本文介绍了访问TextBox控件在ListView控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问文本框里面的控制的ListView控制?

例如我想用 this.AddCommentTextbox.Text 属性code-落后。

ASPX code:

 < ASP:ListView控件ID =PostsListView=服务器的DataSourceID =EntityDataSourcePosts>
   <&ItemTemplate中GT;
     < ASP:文本框文本=活动ID =AddCommentTextbox=服务器的TextMode =多行HEIGHT =100WIDTH =370>< / ASP:文本框>
   < / ItemTemplate中>
 < / ASP:的ListView>


解决方案

您可以尝试这样的事:

 文本框tmpControl =(文本框)PostsListView.FindControl(AddCommentTextbox);

那么你可以做一些与tmpControl.text

希望有所帮助。

How to access "TextBox" control inside "ListView" Control ?

For example I want to use this.AddCommentTextbox.Text property in code-behind.

aspx code:

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

解决方案

You could try something like this:

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

then you can do something with the tmpControl.text

Hope that helps.

这篇关于访问TextBox控件在ListView控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆