I have a problem in which viewing the status of the repeater, that is, the controls in the repeater do not support their presentation.
I have the following:
Repeater 1:
<asp:Repeater ID="rptImages" runat="server"> <ItemTemplate> <asp:LinkButton Text="Add" CommandName="Add" CommandArgument=<%# Eval("ID") %> runat="server" /> </ItemTemplate> </asp:Repeater>
When you click the link button, the CommandArgument value is stored in a hidden field on the page.
After the postback, I cannot get the value of the hidden field before loading the prerender event handler. Therefore, in my prerender event, I get the value of the hidden field and save it in the List property, for example:
if (!string.IsNullOrEmpty(this.SelectedImageIDsInput.Text)) { this.ImageList.Add(this.SelectedImageIDsInput.Text); }
And the List property looks like this:
public List<string> ImageList { get { if (this.ViewState["ImageList"] == null) { this.ViewState["ImageList"] = new List<string>(); } return (List<string>)(this.ViewState["ImageList"]); } set { this.ViewState["ImageString"] = value; } }
Once I have stored the value in my List Property, I bind my second repeater (again in the prerender event):
this.rptSelectedImages.DataSource = this.LightBoxControl.ImageList; this.rptSelectedImages.DataBind();
The second repeater has a drop-down list and a text field inside it. The problem is that the viewstate of these child controls is not supported. I assume this is due to the fact that with every postback I rewrite the relay, so it is rebuilt. I do not know how I can get around this? The ImageList property is only updated after the postback, so I obviously have to retry the repeater with each postback - how else can this be done?
Any help would be greatly appreciated.
Thanks al
higgsy
source share