读书人

repeater 的HeaderTemplate里面的labe

发布时间: 2012-03-26 15:46:56 作者: rapoo

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

读书人网 >asp.net

热点推荐