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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:09:14+00:00 2026-05-12T06:09:14+00:00

I have an Asp.net MVC partial view that is used for searching. It does

  • 0

I have an Asp.net MVC partial view that is used for searching. It does an Ajax call to retrieve results. Once the results are retrieved and displayed in the result pane, the user can click on a link in any of the result rows to select one of the search results. When the user clicks on a link to select one of the search results, it will make an Ajax post request to update some state. Once this Ajax call is complete, I need to redirect to another page, but the destination page depends on which page the user is on. This search partial view will be hosted in multiple pages and the redirect location will be different for each of the host pages. I cannot think of a way to do this that makes sense and doesn’t couple the partial view to the hosting page (or vice versa) excessively.

I guess the other option might be to redirect to another page once the selection Ajax call is complete (this is ultimately the goal), but won’t a redirect result within an Ajax call get swallowed?

Or is there a way to have a button or link on each row instead that causes a post request to occur that could return a redirect result, with the destination based on the calling page?

  • 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-12T06:09:14+00:00Added an answer on May 12, 2026 at 6:09 am

    I ended up using a sort of TemplateMethod pattern to make this work. In my partial I have added the JavaScript function:

    function onActionCompleted() {
        DoSomethingLocal();
        if (typeof DoSomethingInParentPage == 'function') {
            DoSomethingInParentPage();
        }
    } 
    

    This checks to see if the function exists and is a function, and if it is it calls the function. In order for this to work, the hosting page can choose to implement the method DoSomethingInParentPage to complete some action when the action is completed in the partial. I am not sure how to check the parameters match, but at least I get a call when the partial has finished its work.

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

Sidebar

Related Questions

I have an ASP.Net MVC Ajax.BeginForm that submits and updates my page properly when
Using ASP.NET MVC & Spark, I have a view that is listing a number
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When
I have an ASP.NET MVC project with a form. In the Action method that
I have an asp.net mvc app running on a local iis website that is
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I have an ASP.NET MVC project and I have a single action that accepts
Scenario: I have a partial view that is used in several places across my
I have an Asp.net MVC project that modestly uses jQuery scripts. My views also

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.