Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Post Back on Web User Control

Reply
Thread Tools

Post Back on Web User Control

 
 
=?Utf-8?B?QnJ5YW4=?=
Guest
Posts: n/a
 
      05-29-2004
When I leave a page that has a user control and press the back button on my browser I notice that the Page_Load event of the user control doesn't fire unless i do a refresh on the page. Is there a way to fire this event when I hit the back button on the browser? Is this by design?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmljaA==?=
Guest
Posts: n/a
 
      05-29-2004
Yes, it's by design in that the Back button is handled stricly within the browser and does not invoke a round-trip to the server. So, there's nothing to cause a server-side page load event to be reised

What can you do? Write a client-side onload event for the window object. In javascript, it would start out like this
<SCRIPT for="window" event="onload">. In that script, you can submit the form. (Something like "document.Form1.submit()" ). That will cause a postback to occur

The only question is: How to make sure that the window onload event is not raised when the page is first loaded? You'll need to check the content of some element on your page that you know will be different, depending on whether the page was freshly loaded or not. I've been known to use a hidden text box for such things but others might have for elegant solutions to offer

HTH
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
Web User Control with GridView can derive new Web User Control? ABC ASP .Net 1 10-04-2005 12:29 PM
Web User Control with GridView can derive new Web User Control? ABC ASP .Net Web Controls 0 10-03-2005 10:23 AM
Web User Control with GridView can derive new Web User Control? ABC ASP .Net 0 10-03-2005 10:23 AM
Web User Control reference set to nothing when post back Jie ASP .Net 1 06-30-2004 02:13 AM



Advertisments