H
Harry
Hello,
I have a Repeater control that contains a Label control inside its
ItemTemplate. A dummy mockup of the HTML code looks as follows:
<asp:repeater id="StyleRepeater" Runat="server">
<ItemTemplate>
<asp:Label ID="ClassLabel" Runat="server">
<... various other ASP.NET Web Controls ...>
</ItemTemplate>
</asp:repeater>
In the code behind for this page, I handle the Repeater's ItemCreated event
to initially set the text of the label. This works perfectly, however, when
a postback occurs and Repeater data is fetched from the ViewState and all my
Web Controls repopulate correctly, except for the Label, which is set to the
empty string (i.e. ""). Since my other controls in the Repeater
(DropDownLists, CheckBoxes, etc.) are being correctly repopulated on
postback from the ViewState, it leads me to believe that there is some
specific problem with saving the Label's ViewState. I tried manually
enabling the ViewState on the label control (i.e. <asp:Label ID="ClassLabel"
EnableViewState="True" Runat="server">), but that had no effect. Any advice
would be much appreciated.
- Harry
I have a Repeater control that contains a Label control inside its
ItemTemplate. A dummy mockup of the HTML code looks as follows:
<asp:repeater id="StyleRepeater" Runat="server">
<ItemTemplate>
<asp:Label ID="ClassLabel" Runat="server">
<... various other ASP.NET Web Controls ...>
</ItemTemplate>
</asp:repeater>
In the code behind for this page, I handle the Repeater's ItemCreated event
to initially set the text of the label. This works perfectly, however, when
a postback occurs and Repeater data is fetched from the ViewState and all my
Web Controls repopulate correctly, except for the Label, which is set to the
empty string (i.e. ""). Since my other controls in the Repeater
(DropDownLists, CheckBoxes, etc.) are being correctly repopulated on
postback from the ViewState, it leads me to believe that there is some
specific problem with saving the Label's ViewState. I tried manually
enabling the ViewState on the label control (i.e. <asp:Label ID="ClassLabel"
EnableViewState="True" Runat="server">), but that had no effect. Any advice
would be much appreciated.
- Harry