首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-03-26 
repeater 的HeaderTemplate里面的label应该如何动态赋值?C# codeHeaderTemplatetable classtablesort

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";
}
}

热点排行