进入一个ListView的LayoutTemplate模板的内部控制 [英] Access a control inside a the LayoutTemplate of a ListView

查看:505
本文介绍了进入一个ListView的LayoutTemplate模板的内部控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问控件中的 LayoutTemplate模板 A 的ListView 控制?

How do I access a Control in the LayoutTemplate of a ListView control?

我需要去 litControlTitle 并设置其文本属性。

I need to get to litControlTitle and set its Text attribute.

<asp:ListView ID="lv" runat="server">
  <LayoutTemplate>
    <asp:Literal ID="litControlTitle" runat="server" />
    <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
  </LayoutTemplate>
  <ItemTemplate>
  </ItemTemplate>
</asp:ListView>

有什么想法?也许通过 OnLayoutCreated 事件?

推荐答案

试试这个:

((Literal)lv.FindControl("litControlTitle")).Text = "Your text";

这篇关于进入一个ListView的LayoutTemplate模板的内部控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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