Post Back on Web User Control

Discussion in 'ASP .Net' started by =?Utf-8?B?QnJ5YW4=?=, May 29, 2004.

  1. 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?
    =?Utf-8?B?QnJ5YW4=?=, May 29, 2004
    #1
    1. Advertising

  2. 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
    =?Utf-8?B?UmljaA==?=, May 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sk2000
    Replies:
    2
    Views:
    4,428
    Kumar
    Nov 12, 2003
  2. =?Utf-8?B?VHJveQ==?=

    user control dissapears from panel on post back

    =?Utf-8?B?VHJveQ==?=, Jan 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    484
    Marina
    Jan 23, 2004
  3. Joby
    Replies:
    0
    Views:
    1,628
  4. Jie
    Replies:
    1
    Views:
    651
  5. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    766
    Masudur
    May 25, 2007
Loading...

Share This Page