Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7507749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:32:59+00:00 2026-05-29T22:32:59+00:00

On the PreRender event of my page, I decide to do a response.redirect() .

  • 0

On the PreRender event of my page, I decide to do a response.redirect().
That means none of the javascript enclosed in <script language="JavaScript" type="text/javascript"> tags on that page are executed.

I wish to do the below :

String allJavaScript = MagicFunctionThatReturnsAllJSInTheControl(someUserControl)

ClientScript.RegisterClientScriptBlock("".GetType(), "s", allJavaScript );

Response.Redirect("~/newpage.aspx",false);

Do you know how would one code up, in C#/vb.net the MagicFunctionThatReturnsAllJSInTheControl(someUserControl)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:33:00+00:00Added an answer on May 29, 2026 at 10:33 pm

    In light of your last comment, I think I have a possible solution, even if it does not answer your question as originally stated.

    So, you want scripts in currentpage.aspx to execute on the client even though you’re in the process of redirecting it to newpage.aspx. In this situation, you can avoid Response.Redirect() and perform the redirection on the client:

    string redirectScript = String.Format(CultureInfo.InvariantCulture,
        "window.location.href = '{0}';", ResolveUrl("~/newpage.aspx"));
    
    ClientScript.RegisterClientScriptBlock(GetType(), "redirectScript",
        redirectScript, true);
    

    This way, the client should load the page and execute the scripts within, then load newpage.aspx. If you can stand the original page to be briefly visible while the redirected page loads, this might solve your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Do you know any drawback to add controls to a page on PreRender event?
A Page.PreRender event is guaranteed to be fired after Page.Load event is fired. But
How can I include Javascript onto my page from a webcontrol that is loading,
I have a UserInfo object that is generated on each page_prerender event. This object
I'm using a implementation of qtip that fires on 'AllDay' event-bar mouse-overs. It has
I am using the Dynamic Drive 'Animated Collapsible DIV v2.4' script - My page
I have a Page (form) that has many UserControls on it, and I'm trying
Here's the problem....I have three components...A Page that contains a User Control and a
Assume I have an asp:GridView with some customer information. On that page I also
I'm currently learning ASP.NET, and read that the page validation occurs after Page.Load(). When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.