J
Johnny Fugazzi
Good morning,
Background: I am working on a web that will display information about
companies and contacts. I would like to have a details page that displays
some basic details about the record that has been selected (works), and then
have a table with a series of "tabs" that load additional details. I am
using this approach to cut down on the number of pages needed.
The "tabs" are a series of linkbuttons that clear a panel, and then
dynamically add a specific usercontrol to a panel. The error I am getting
when I do this is:
"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. "
I have included example code for two of the "tab" buttons
---
Private Sub btnAddressing_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddressing.Click
resetTabs()
'btnAddressing.Font.Size = FontUnit.Small
btnAddressing.Font.Underline = True
btnAddressing.ForeColor = Drawing.Color.DarkRed
pnlDetails.Controls.Clear()
Dim ctlAddresses As Control =
LoadControl("companyDetailsAddresses.ascx")
ctlAddresses.ID = "ctlAddresses"
pnlDetails.Controls.Add(ctlAddresses)
End Sub
Private Sub btnCategoris_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCategoris.Click
resetTabs()
'btnCategoris.Font.Size = FontUnit.Small
btnCategoris.Font.Underline = True
btnCategoris.ForeColor = Drawing.Color.DarkRed
pnlDetails.Controls.Clear()
Dim ctlCategories As Control =
LoadControl("companyDetailsCategories.ascx")
ctlCategories.ID = "ctlCategories"
pnlDetails.Controls.Add(ctlCategories)
End Sub
Background: I am working on a web that will display information about
companies and contacts. I would like to have a details page that displays
some basic details about the record that has been selected (works), and then
have a table with a series of "tabs" that load additional details. I am
using this approach to cut down on the number of pages needed.
The "tabs" are a series of linkbuttons that clear a panel, and then
dynamically add a specific usercontrol to a panel. The error I am getting
when I do this is:
"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. "
I have included example code for two of the "tab" buttons
---
Private Sub btnAddressing_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddressing.Click
resetTabs()
'btnAddressing.Font.Size = FontUnit.Small
btnAddressing.Font.Underline = True
btnAddressing.ForeColor = Drawing.Color.DarkRed
pnlDetails.Controls.Clear()
Dim ctlAddresses As Control =
LoadControl("companyDetailsAddresses.ascx")
ctlAddresses.ID = "ctlAddresses"
pnlDetails.Controls.Add(ctlAddresses)
End Sub
Private Sub btnCategoris_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCategoris.Click
resetTabs()
'btnCategoris.Font.Size = FontUnit.Small
btnCategoris.Font.Underline = True
btnCategoris.ForeColor = Drawing.Color.DarkRed
pnlDetails.Controls.Clear()
Dim ctlCategories As Control =
LoadControl("companyDetailsCategories.ascx")
ctlCategories.ID = "ctlCategories"
pnlDetails.Controls.Add(ctlCategories)
End Sub