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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:45:54+00:00 2026-05-25T10:45:54+00:00

I have 2 Actions in my controller: // GET: /Directory/ public ActionResult Index() {

  • 0

I have 2 Actions in my controller:

// GET: /Directory/
public ActionResult Index()
{
    ViewModels.DirectoryIndex model = new ViewModels.DirectoryIndex();
    return View(model);
}

// POST: /Directory/Filter/[viewModel]
[HttpPost]
public ActionResult Filter(ViewModels.DirectoryIndex viewModel)
{
    int distance = 0;
    string state = string.Empty;

    if (viewModel.SelectedDistance > 0)
        distance = viewModel.SelectedDistance;
    else if (viewModel.SelectedState > 0)
        state = viewModel.States.Where(a => a.Value == viewModel.SelectedState.ToString()).FirstOrDefault().Text;

    // TODO:  Add filter activities here...

    return PartialView("IndexPartial", viewModel);
}

I have a View and a PartialView (NOTE: I am not using Razor!)

The view looks like:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<RainWorx.FrameWorx.MVC.ViewModels.DirectoryIndex>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="Column12">
        <div class="Shadow"></div>
        <h2 class="h2row"><%= Model.PageTitle %></h2>

        <% using (Ajax.BeginForm("Filter", new AjaxOptions { UpdateTargetId = "filteredList" })) {  %>
        <div class="searchDirectory">
            <label title="State">State:&nbsp;</label>
            <%= Html.DropDownListFor(a => a.SelectedState, Model.States, "-- Select One --", new { @id = "ddlStates" })%>
            &nbsp;&nbsp;-or-&nbsp;&nbsp;
            <label title="ZipCode">Zip Code within:&nbsp;</label>
            <%= Html.DropDownListFor(a => a.SelectedDistance, Model.Distance, "-- Select One --", new { @id = "ddlDistance" })%>
            <input type="text" id="myZip" name="myZip" />
            <input type="submit" value="Filter" />
        </div>
        <% } %>

        <div id="filteredList" class="businessCard">
            <% { Html.RenderPartial("IndexPartial", Model); } %>
        </div>

        <div style="height: 200px;"></div>
    </div>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" href="Content/css/directory.css" rel="Stylesheet" />
    <script src="Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript" />
    <title><%= Model.PageTitle %></title>
</asp:Content>

The PartialView looks like:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<RainWorx.FrameWorx.MVC.ViewModels.DirectoryIndex>" %>

<% foreach (var d in Model.Dealers) { %>
<div class="businessCard Outline">
    <div class="businessCard Logo">
        <img src="<%= Url.Content("~/Content/Images/Directory/logo01_150wide.png") %>" alt="Logo" />
    </div>
    <div class="businessCard Info">
        <div class="businessCard Name"><%= d.Name %></div>
        <div class="businessCard Address"><%= d.Address %></div>
        <div class="businessCard City"><%= d.City %>, <%= d.State %>  <%= d.ZipCode %></div>
        <div class="businessCard Phone"><%= d.Phone %></div>
    </div>
</div>
<% } %>

Now, for some reason, when I select a filter to use and submit the form it does call into the second action correctly. However, it does not refresh the PartialView, instead I get the PartailView rendered as a full view. In URL terms:

  1. I start at http://mysite.com/Directory – select my filter, click submit.
  2. I end at http://mysite.com/Directory/Filter when I expect to end at http://mysite.com/Directory !!

I am obviously missing something simple. I’ve done this before in Razor (love Razor over this mess BTW) and it all works there.

NOTE: This is a 3rd party product I am extending so don’t have the luxury of converting everything to Razor.

  • 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-25T10:45:55+00:00Added an answer on May 25, 2026 at 10:45 am

    You need to have both the following files referenced in your html. I think there is a jQuery alternative… but referencing both of these JavaScript files (which are probably already in your MVC solution) should solve your problem.

    <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple controller actions that takes an id public ActionResult Get(int? id) {
If i have a Controller Action that may recieve both HTTP GET and HTTP
Several of my controller actions have a standard set of failure-handling behavior. In general,
I would like to have 4 actions with the same name (controller methods may
Most of the actions in my controller have statically-defined parameter lists and so they
I have a controller called Admin with a number of Actions. In the URL,
Lets say I have a controller which provides search functions for a student: public
I typed this: http://localhost/dev.gamenomad.com/Index and I have got this controller in my zend project:
I have the following in my Global.asax.cs routes.MapRoute( Arrival, {partnerID}, new { controller =
I have a controller as follows that returns a byte[] public class ImageController :

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.