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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:06:59+00:00 2026-05-30T06:06:59+00:00

I have an MVC3 application that I am implementing pjax into . Everything is

  • 0

I have an MVC3 application that I am implementing pjax into . Everything is working well except what to do on the server side when an address gets loaded that doesn’t already have the main view on the client side. My Controller code looks like

public virtual ActionResult Details(Guid id)
    {
        var partDetail = new PartDetail(id);
        var partialView = PartialView("Details", partDetail);
        if(Request.Headers["X-PJAX"]!= null)
        {
            return partialView;
        }

        var mainView =  View("Index");
        // Stick Partial View into main view at #update_panel?
        return mainView;
    }

How can I stick the partial View into the main view so it inserts the partial view in the #update_panel?

  • 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-30T06:07:01+00:00Added an answer on May 30, 2026 at 6:07 am

    Ok, without a major refactor, you could do the following.

    (this assumes that you are able to set the @model on index.cshtml to PartDetail()).

    in your controller action above, change:

    var mainView =  View("Index");
    

    to:

    var mainView =  View("Index", partDetail);
    

    then, inside your index.cshtml, add the following:

    <div id="update_panel">@RenderPartial("Details", Model)</div>
    

    As i said, this will ONLY work if the index @model is set to PartDetail(), otherwise, a little refactoring on the model in the index view will be required to include this PartDetail() model. this viewmodel might well look like the following:

    public class IndexViewModel
    {
        ModelForIndex Index{get; set;}
        PartDetail Details{get; set;}
    }
    

    this refactored viewmodel would be added to the index.cshtml as @model IndexViewModel and consumed by the partial as:

    <div id="update_panel">@RenderPartial("Details", Model.Details)</div>
    

    hope this makes sense.

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

Sidebar

Related Questions

I have an MVC3 application that is recently published to a web server. This
Im working on an mvc3 application that will be deployed globally and have a
I have an MVC3 + EF 4.1 application, against a SQL Server 2008 database,
I have an MVC3 application that has a custom HandleErrorAttribute so that I can
MVC3 vb.net Application using built in session management. I have an mvc3 application that
I have an MVC3 application that supports multiple languages. Do I need to create
I have lots of forms in my MVC3 application that require the user to
I have an ASP MVC3 application that runs fine (in VS 2010 debug) in
I have a fairly simple Action in an MVC3 application that should render an
I have an MVC3 application into which I'm integrating WIF. Before starting on this

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.