SaaS CMS has officially launched! Learn more now.

get text of all the textbox inside episerver pagelist


Hi I have a episerver pagelist  showing the name of page and textbox field which is editable. Then I have a button in my page which is not inside the pagelist. onclick of this button i want all the values of the textbox. I am trying

private void Button_Click(object sender, System.EventArgs e)
                foreach (PageList item in productList)

where productList is the id of the pageList. But dosnt work.Please help

Jan 18, 2011 8:31

This isn't necessarily simple or even the way to go (using the PageList control, that is). If you remember the page lifecycle controls have to be recreated before the Load event to have their values set from the posted values/viewstate. Moreover, the controls have to have identical ID:s/places in the control tree.

Also, you are enumerating over pagelists inside your pagelist, which there are probably none?

I think the GridView control is better suited for what you are trying to accomplish. You'll find countless examples of using that out there on the web.

Edited, Jan 18, 2011 9:52
Jan 18, 2011 11:08

Thanks for the Reply.

To get this solved I am using the Dictionary Object .I have added the HiddenField in the episerver PageList.

<EPiServer:PageList  runat="server" ID="productList" >        
    <td>Määrä<asp:TextBox ID="txtAmount" runat="server" value="<%# GetTxtValue(Container.CurrentPage.PageLink) %>" ></asp:TextBox>
    <asp:HiddenField  runat="server" ID ="txtAmountH" value="<%# Container.CurrentPage.PageLink %>" />
I am getting the list of both the textbox as well as hiddenField from the Blog solution given by Anders. :)

foreach (HiddenField hiddenf in hiddenList)
        string ID = hiddenf.ClientID;
        ID = ID.Replace("txtAmountH", "txtAmount");
        var TxtBox = from item in boxes
                     where item.ClientID == ID
                     select item;
        if (null != TxtBox)
            dList.Add(hiddenf.Value.ToString(), Convert.ToInt32((TxtBox.First() as TextBox).Text));

and then I an using this Dictionary object to get the values.


Jan 18, 2011 12:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.