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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:58:14+00:00 2026-05-24T10:58:14+00:00

First off, I am an ASP.NET MVC noob. It’s my first project with ASP.NET

  • 0

First off, I am an ASP.NET MVC noob. It’s my first project with ASP.NET MVC, so I am still learning. My background is mostly in WPF and XAML for the past two years.

So here is my problem: I have three cascading ListBoxes. The second listbox data is dependent on the first, and the third is dependent on the second. I want to use Ajax refreshes to fill the data in each list.

Here is my Index.cshtml:

@model WebApplication.Models.DevelopmentModel

<!DOCTYPE html>

<html>
<head>
    <title>Dashboard</title>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
</head>

<body class="body" scroll="auto">

    <div class="page">
            <div class="content">

                <div id="lists">

                    @Html.Partial("DevelopmentListsView", Model)

                </div>
            </div>
    </div>

</body>
</html>

My DevelopmentListsView.cshtml looks like this:

@model WebApplication.Models.DevelopmentModel

@using (Ajax.BeginForm("Index", "Development", new AjaxOptions() { UpdateTargetId = "lists" } ))
{
    @Html.ListBoxFor(m => m.SelectedApplication, new SelectList(ViewBag.Applications), new { onchange = "this.form.submit();" })
    @Html.ListBoxFor(m => m.SelectedVersion, new SelectList(ViewBag.Versions), new { onchange = "this.form.submit();" })
    @Html.ListBoxFor(m => m.SelectedFlow, new SelectList(ViewBag.Flows) )
}

My Model looks like:

public class DevelopmentModel
{
    public string SelectedApplication { get; set; }
    public string SelectedVersion { get; set; }
    public string SelectedFlow { get; set; }
}

And my Controller looks like this:

public class DevelopmentController : Controller
{
    //
    // GET: /Development/

    public ActionResult Index()
    {
        FillViewBag();

        return View(new DevelopmentModel());
    }


    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Index(DevelopmentModel model)
    {
        FillViewBag(model);

        return PartialView("DevelopmentListsView", model);
    }


    private void FillViewBag(DevelopmentModel model = null)
    {
        //Magic to get all three lists dependent on the available data in the model:

        ViewBag.Applications = applications;
        ViewBag.Versions = versions;
        ViewBag.Flows = flows;
    }

}

Now, I want to use Ajax callbacks to retrieve the data, so it won’t refresh every time, but when I click one of the Listbox items, the page then only shows the DevelopmentListsView view after that, not refreshing anything..

Can someone tell me what I am doing wrong?

Thanks for looking!

  • 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-24T10:58:14+00:00Added an answer on May 24, 2026 at 10:58 am

    Figured out my own question:

    I had two errors:

    I missed the jquery script include in the Index.cshtml:

    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
    

    And I used the wrong submit (it should have been the jQuery submit):

    $(this.form).submit()
    

    The submit placed inside my models

    @model WebApplication.Models.DevelopmentModel
    
    @using (Ajax.BeginForm("Index", "Development", new AjaxOptions() { UpdateTargetId = "lists" } ))
    {
        @Html.ListBoxFor(m => m.SelectedApplication, new SelectList(ViewBag.Applications), new { onchange = "$(this.form).submit()" })
        @Html.ListBoxFor(m => m.SelectedVersion, new SelectList(ViewBag.Versions), new { onchange = "$(this.form).submit()" })
        @Html.ListBoxFor(m => m.SelectedFlow, new SelectList(ViewBag.Flows) )
    }
    

    Hope this helps someone some day ;).

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

Sidebar

Related Questions

First off, I'm very new to Azure. I've successfully deployed an ASP.NET MVC 3
First off let me say this is my first ASP.NET project I have done.
First off, let me clarify the platforms we are using. We have an ASP.NET
This question is being based off of a similar question titled, ASP.NET MVC Relative
I'm learning C# and working on my first ASP.Net e-commerce website. I have the
So, I am using ASP.NET MVC 3 and Entity Framework 4.1 (code-first). I have
In my ASP.NET MVC WebApi project I have a Repository (with an Interface) that
When I discovered MVC (first with ASP.NET MVC), I thought it was the holy
I'm new to web development and working on my first ASP.NET MVC 3 app.
I'm learning ASP.NET MVC 3 to build a web application. I've followed a couple

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.