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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:08:47+00:00 2026-06-14T10:08:47+00:00

I’m new to MVC 4 and the Razor engine – so this might be

  • 0

I’m new to MVC 4 and the Razor engine – so this might be a dumb question.

What I’m trying to achieve is I have a page with a drop down list and a button. Clicking the button calls the controller passing the value selected. The controller should return a partial view and only the bottom part of the page should be updated.

However I’m finding that the entire page gets replaced with just the partial view html. Ie. I get my list of results displaying but I lose my dropdownlist of projects and submit button. I tried including a reference to jquery and unobtrusive scripts (which I don’t think I need to in MVC 4) but that doesn’t change the page at all (ie. the dropdownlist and button stay there and no results are displayed).

Part of my View:

@using (Ajax.BeginForm("GetProjectStories", "MyController", new AjaxOptions{ UpdateTargetId = "projectUserStories"}))
{

    <fieldset>
        <legend>Select Project</legend>
        <div>
            @Html.DropDownList("ProjectReference", (IEnumerable<SelectListItem>)Model.ProjectList)
        </div>
        <p>
        <input name="GetStoriesButton" type="submit" value="Get Stories" />
        </p>
    </fieldset>
}

@if (Model != null && Model.UserStories != null)
{
    <div id="projectUserStories">
        @{Html.RenderPartial("_UserStoryList", Model);}
    </div>

}

My controller:

public ActionResult GetProjectStories(ProjectViewModel model)
        {

           var stories =  MyService.GetProjectUserStories(model.ProjectReference).Results;   
           model.UserStories = stories;
            return PartialView("_UserStoryList", model);
        }

My partial view content just contains an html table and reference to the model.

  • 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-14T10:08:48+00:00Added an answer on June 14, 2026 at 10:08 am

    So I tried including that unobtrusive script, and fixing the fact I wasn’t rendering that div if that object was null but it still wasn’t working.

    So I switched to using jquery.

        <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    
        <script type="text/javascript">
                $(function () {
                    $('form').submit(function () {
                        var url = "@Url.Action("GetProjectStories", "MyController")";
                        var data = { selectedProject: $('#ProjectReference').val() };
    
                        $("#projectUserStories").load(url, data, function() {
                        });
                        return false;
                    });
                });
    
         </script>
    
            @using (Html.BeginForm())
            {
                <fieldset>
                    <legend>Select Project</legend>
                    <div>
                        @Html.DropDownList("ProjectReference", (IEnumerable<SelectListItem>) Model.ProjectList)
                    </div>
                    <p>
                        <input name="GetStoriesButton" type="submit" value="Get Stories" />
                    </p>
                </fieldset>
    
                <div id="projectUserStories">
                    @{ Html.RenderPartial("_UserStoryList", Model); }
                </div>
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.