J
j-in-uk
I have linkButtons on my page, onclick of the link button I want to
load the proper usercontrol, this works fine the 1st time I click but
when I click the 2nd linkButton
I get "Failed to load viewstate. The control tree into which
viewstate is being loaded must match the control tree that was used to
save viewstate during the previous request. For example, when adding
controls dynamically, the controls added during a post-back must match
the type and position of the controls added during the initial
request. "
This is all the code I have on my page. Any help pls.Thanks
protected void LButton1_Click(object sender, EventArgs e)
{
plcH.Controls.Add(LoadControl("Control1.ascx"));
}
protected void LButton2_Click(object sender, EventArgs e)
{
plcH.Controls.Add(LoadControl("Control2.ascx"));
}
I'm assuming I need to reload the controls in Page_Init()
Do I check again which button is clicked inorder to reload the
controls?
load the proper usercontrol, this works fine the 1st time I click but
when I click the 2nd linkButton
I get "Failed to load viewstate. The control tree into which
viewstate is being loaded must match the control tree that was used to
save viewstate during the previous request. For example, when adding
controls dynamically, the controls added during a post-back must match
the type and position of the controls added during the initial
request. "
This is all the code I have on my page. Any help pls.Thanks
protected void LButton1_Click(object sender, EventArgs e)
{
plcH.Controls.Add(LoadControl("Control1.ascx"));
}
protected void LButton2_Click(object sender, EventArgs e)
{
plcH.Controls.Add(LoadControl("Control2.ascx"));
}
I'm assuming I need to reload the controls in Page_Init()
Do I check again which button is clicked inorder to reload the
controls?