当前位置: 代码迷 >> ASP.NET >> repeater 的HeaderTemplate里面的label应该怎么动态赋值
  详细解决方案

repeater 的HeaderTemplate里面的label应该怎么动态赋值

热度:6838   发布时间:2013-02-25 00:00:00.0
repeater 的HeaderTemplate里面的label应该如何动态赋值?
C# code
                <HeaderTemplate>                <table class="tablesorter" style="word-break:break-all;table-layout:fixed; font-size:20px;">                    <thead>                        <tr>                            <th style="width:60px;"><asp:Label ID="Label1" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label2" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label3" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label4" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label5" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label6" runat="server"></asp:Label></th>                            <th style="width:60px;"><asp:Label ID="Label7" runat="server"></asp:Label></th>                                                                  </tr>                   </thead>                   <tbody>                </HeaderTemplate>


------解决方案--------------------------------------------------------
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
Label Label1 = e.Item.FindControl("Label1") as Label;
Label1.Text = "xxx";
}
}
  相关解决方案