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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:02:05+00:00 2026-06-13T07:02:05+00:00

I have a view which calls a partial view using: Html.RenderPartial I’d like to

  • 0

I have a view which calls a partial view using:

Html.RenderPartial

I’d like to call this in isolation using a controller method to stop the whole page having to be refreshed but controller methods returning void seem to destroy the existing view (I get a blank screen).

I have the javascript code to update the HTML document section but I can’t see how to retain the view/get a reference to it in the controller to call the javascript method.

I should add that I’m fairly new to this MVC3 thing.

N.B. to cut a long story short, using JQuery is not an option so we’re limited to Javascript unfortunately.

  • 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-13T07:02:06+00:00Added an answer on June 13, 2026 at 7:02 am

    The basic pattern is to create a PartialView result in the Controller and use that result to update the innerHTML of some container on your page:

    HTML

    <input type="button" onclick="UpdateMyContainer();" value="Update" />
    
    <div id="MyContainer">
        @Html.Partial( "_MyPartialView", Model )
    </div>
    

    JavaScript

    Follow Ajax without jQuery for beginners for creating an Ajax method that doesn’t require JQuery. Essentially:

    function UpdateMyContainer() {
      var xmlHttp = createXMLHttp();
      // set your controller URL here:
      xmlHttp.open('get', 'Url/To/SomeMethodInController', true);
      xmlHttp.send(null);
      xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState === 4) {
          if (xmlHttp.status === 200) {
            // Set the Id of the container to update here:
            document.getElementById('MyContainer').innerHTML = xmlHttp.responseText;
          } else {
            alert('Error: ' + xmlHttp.responseText);
          }
        } else {
          //still loading
        }
      };
    }
    

    The above JS could be further refactored to take in a URL and an ID of an element to update.

    Controller

    [HttpPost]
    public PartialViewResult SomeMethodInController()
    {
        var model = MethodToRetreiveModel();
    
        return PartialView( "_MyPartialView", model );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which is rendered using html.RenderAction in MVC3. Outside of this
Using asp.net MVC3, I have a partial view which requires remote validation. As I
I have an ajax call which returns a partial view which I want to
I have a partial view which is returned via an Ajax call with a
I have a view called, clients which shows a list of calls from the
i have view controller which contains a button which show the image library ,if
I have a view which I would like to fill up the entire screen
I have LogOn.ascx control which is located on master page site.master: <% Html.RenderPartial(LogOn); %>
I have a partial view which contains the following snippet: @model Mbrrace.Domain.MbrraceForm <div class=row>
not sure how to word this correctly.. so i have a view which has

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.