Women in Technology

Hear us Roar



Article:
  Enhancing ASP.NET Pages with JavaScript
Subject:   Problem with Page.RegisterStartupScript
Date:   2005-03-23 22:45:28
From:   vishalvishal
Hi,


when you add javascript code to your page using Page.RegisterStartupScript and you redirect to some other page and now if you use browser's back button and come to the original page the script add get's executed automatically.
If i am showing a confirm and clicking "yes" button i redirect user to some other page through javascript's window.location.href='ABC.aspx'
and if i press browser's back button on ABC.aspx page i see the confirmation box on the previous page.


So is there any way that i can avoid this.


thnx..

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Problem with Page.RegisterStartupScript
    2006-06-27 04:35:50  ROCK007 [View]

    Hi All,
    Another same alike query. When we add a Page.RegisterStartupScript and try to browse to another page from the current page (where this javascript is written), we get a message saying "Do you really want to navigate from the current page?" since we have used window.BeforeUnload to halt when some values are changed. Even though we have clicked "Cancel" button to avoid going out of the page, it stays back but after clicking the "save" button it does not fires the "Button_Click" event handler. This Button click handler works with the normal case.

    What should be done to drap the Button_Click event in such case?

    ThanX

  • Problem with Page.RegisterStartupScript
    2005-05-20 03:11:21  u [View]

    set a flag for back and in main page check the flage if true? no action should be done.like this one
    if(!Back)
    page.RegisterStartupScript("name",name)
    • Problem with Page.RegisterStartupScript
      2007-01-29 11:43:13  Manindra [View]

      Try this,
      Page.ClientScript.RegisterStartupScript(GetType(string), "name", name)

      I hope it will work...