小编Cal*_*ine的帖子

在ListView EmptyDataTemplate中查找控件

ListView喜欢这个

<asp:ListView ID="ListView1" runat="server">
   <EmptyDataTemplate>
      <asp:Literal ID="Literal1" runat="server" text="some text"/>
   </EmptyDataTemplate>
   ...
</asp:ListView>
Run Code Online (Sandbox Code Playgroud)

Page_Load()我有以下几点:

Literal x = (Literal)ListView1.FindControl("Literal1");
x.Text = "other text";
Run Code Online (Sandbox Code Playgroud)

但是x回归null.我想更改Literal控件的文本,但我不知道如何做到这一点.

.net c# asp.net listview findcontrol

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

asp.net ×1

c# ×1

findcontrol ×1

listview ×1