This isn't necessarily simple or even the way to go (using the PageList control, that is). If you remember the asp.net 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 asp.net 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.
have answared this question here
http://world.episerver.com/Templates/Forum/Pages/thread.aspx?id=47099
Hi,
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 %>" />
</EPiServer:PageList>
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.
}
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)
{
Response.Write(((TextBox)item.Controls[1]).Text);
}
where productList is the id of the pageList. But dosnt work.Please help