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 8103961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:41:59+00:00 2026-06-05T23:41:59+00:00

in my asp.net application, two buttons call a javascript function called refreshView, below is

  • 0

in my asp.net application, two buttons call a javascript function called refreshView, below is the function refreshView.

function RefreshView() {
                        __doPostBack('ButtonApply', '')
                        window.parent.location.href = "dashboardtree.aspx"
                    }

In IE, this is working correctly, but in firefox and safari the page refreshes (due to the window.parent.location) – but never calls the doPostBack (i was able to tell this using tracepoint and the sub that is called stores values to the database, the values are not being stored as well, sub is never hit). Below is the first line of the sub.

 Private Sub ButtonApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonApply.Click

Can anyone see why this would not work? I figured I could always replace the doPostBack with pageMethods and create a new sub/function – but I’d like to complete this the way it currently is. Thank you.

  • 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-06-05T23:42:00+00:00Added an answer on June 5, 2026 at 11:42 pm

    Don’t perform a redirect and postback at the same time in your JavaScript routine. What you should do instead is to redirect after your postback logic has completed. You will only know when it is completed in the Codebehind or if your Javascript received some sort of Asynchronous callback. In its current state, your JavaScript routine has no idea when your Postback will complete.

    You are creating a conflict. What you are essentially doing is telling the page to post and at the very same time to redirect somewhere else. In all likelihood, FireFox and Safari probably ignored the __doPostBack() because of this fact.

    Here’s what I would do instead:

    public void Page_Load(object sender, EventArgs e)
    {
      string target = Request["__EVENTTARGET"];
      //if parameter equals "ButtonApply"
      //{       
      //    Do whatever, Then...
      //    Response.Redirect("dashboardtree.aspx"); <- you may need to modify the url depending on your structure
      //}
    }
    

    EDIT

    ...about the response.redirect - this will not work for me because the page that contains the post back, is an iframe inside another page...
    

    Apologies, I missed the window.parent.

    What I would recommend then is to use ajax. In a nutshell, you would use ajax to place a call to a server-side method which would perform your logic (that you currently do in the postback). Upon completion, the client will be notified in a callback when the process has completed (and whether or not it was successful). Upon successful completion, you would perform your redirect.

    There are several examples of this on the web, I’ll provide a few for you:

    • Using jQuery to directly call ASP.NET AJAX page methods
    • Using jQuery to Call ASP.NET AJAX Page Methods – By Example
    • Call server side method from client side using script manager
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on an Asp.net MVC Web application. In my solution, there're two
I am building a web application using ASP.NET MVC that has two very distinct
My asp.net application is not using formsauthentication. Instead we make a call to database,
I have an ASP.Net application running under IIS 6. A simple page has two
I have an ASP.NET application that is running on two load balanced servers. Everything
In my ASP.NET application, I was trying to add few white spaces between two
In my asp.net application I have two pages like new students and edit students.
My asp.net application have two config files: web.config and hibernate.config. When I add SysCache
I am developing an ASP.NET MVC application that has two kind of pages: (1)
As part of building an ASP.net application, I have to display two things for

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.