467,911 Members | 1,364 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help...

Here's the layout. Aspx has a repeater on the left, which will call a
function to change a session var that holds the usercontrol name to add
(i.e. "uc_myusercontrol.ascx") and then calls default.aspx which in
page init, loads the control.

The problem is that if the user clicks on a link, the page starts to
reload but the user clicks on another link prior to the page completing
the load the viewstate error happens. Here's some relevant code below.

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
End Sub

Public Sub loadUC(ByVal contname As String)
Dim mainuc As New System.Web.UI.Control
mainuc = LoadControl("usercontrols\" & contname)
mainuc.ID = Left(contname, (Len(contname) - 5))
Session.Contents("LoadedUC") = contname
End Sub

---And called from any page to reload---
Public Shared Function setpage(ByVal newpage As String)
HttpContext.Current.Session.Contents("CurrentUC") = newpage
HttpContext.Current.Response.Redirect("default.asp x")
End Function

I've tried setting enableviewstate = false on the PH but then nothing
in the app works (data binding and such) after postback.
Really need to figure out a way to stop the "setpage" from happening
until the page is fully loaded. Any ideas would be GREATLY Appreciated.

Nov 19 '05 #1
  • viewed: 824

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Andy Cunningham | last post: by
1 post views Thread by Dave Bartlett | last post: by
2 posts views Thread by Steve Murphy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.