473,513 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

----Aspx
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
InitializeComponent()
loadUC(Session.Contents("CurrentUC"))
End Sub

Public Sub loadUC(ByVal contname As String)
ph_MainForm.Controls.Clear()
Dim mainuc As New System.Web.UI.Control
mainuc = LoadControl("usercontrols\" & contname)
mainuc.ID = Left(contname, (Len(contname) - 5))
ph_MainForm.Controls.Add(mainuc)
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
0 959

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1706
by: Andy Cunningham | last post by:
Hi all, Has anyone seen a problem like this before: http://80.177.2.28/phpinfo.php This is a webserver on my home PC, and when viewed from there it looks fine. However, from computers across...
3
5325
by: Greg Andora | last post by:
Hello, I've had an ASP page that worked for at the minimum for a year and now it is acting very odd and I need some help to fix it. What my page does/did is creates a Word.Application object and...
1
5349
by: George | last post by:
Hi, I am trying to write a query in Oracle which I have not done before, and are having some difficulty getting my result. Please check my query and my results. select max(note.datetime),...
1
2405
by: Steph | last post by:
I am trying to save a simple integer value in ViewState. I set the value in the Page_Load() event and retrieve it in the function Page_Unload() event. The value seems to be set correctly, but...
1
1270
by: Dave Bartlett | last post by:
I've been wondering for a while if I can safely turn off viewstate on a datagrid. I read the following article:...
2
1120
by: Steve Murphy | last post by:
I have an application where I need to leave a page, perform some processing, and then return. On return, one set of fields will be updated, but the remainder should remain in the state they were in...
4
5123
by: scottcly | last post by:
I have a simple editor with a Gridview and a DetailsView. The Gridview handles DELETE and the DetailsView handles UPDATE and ADD. A panel around each one and some minor event handling is used to...
0
2899
by: Ben Thorp | last post by:
I am using VB.NET 2003, SP1. I've recently added a few files to my project. When setting breakpoints in these files, I get the dreaded question-marked breakpoint with a tooltip "The breakpoint...
1
2219
by: terrybali | last post by:
Hi Guys I am new to forum and nontechnical. My site has several large flash files. I am looking for someone who can help us solve two problems. Willing to pay whatever normal rate is for this...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7111
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.