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

  • Home
  • SEARCH
  • 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 3848374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:41:32+00:00 2026-05-19T16:41:32+00:00

I am having difficulty in doing the following and if anyone can give me

  • 0

I am having difficulty in doing the following and if anyone can give me an idea how I can achieve the following:

Upon a new selection in the dropdown, I call the action Status and passing the selected value in the dropdown as parameter.

I have a dropdown as follows in my view

@Html.DropDownList("Status", Model.DisplayStatus)

In My controller, I am having

private ActionResult Status(string active = "All")
     {
         UserModel model = new UserModel(active);
         return View("Users", 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-05-19T16:41:33+00:00Added an answer on May 19, 2026 at 4:41 pm

    I would use strongly typed helpers and jquery. Like this:

    public class MyViewModel
    {
        public string Status { get; set; }
        public IEnumerable<SelectListItem> Statuses
        {
            get
            {
                return new[]
                {
                    new SelectListItem { Value = "online", Text = "Online" },
                    new SelectListItem { Value = "offline", Text = "Offline" },
                    new SelectListItem { Value = "all", Text = "All" },
                };
            }
        }
    }
    

    then a controller:

    public class HomeController: Controller
    {
        public ActionResult Index()
        {
            return View(new MyViewModel());
        }
    
        public ActionResult Status(string status)
        {
            UserModel model = new UserModel(status);
            return View("Users", model);
        }
    }
    

    and finally the view:

    @model AppName.Models.MyViewModel
    @using (Html.BeginForm("Status", "Home", FormMethod.Post, new { id = "myForm" }))
    {
        @Html.DropDownListFor(
            x => x.Status, 
            new SelectList(Model.Statuses, "Value", "Text"),
            new { id = "status" }
        )
    }
    

    and some script to attach to the change event and submit the form:

    <script type="text/javascript">
    $(function() {
        $('#status').change(function() {
            $('myForm').trigger('submit');
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty doing this seemingly simple task. I want to load XML files
Im having difficulty trying to design a database structure for the following scenario: My
I am having difficulty getting rid if the following error: bash-3.00$ p4 login Enter
Following results are very interesting and I am having difficulty understanding them. Basically I
I have just started using Rhino mocks and I am having difficulty doing that.
I have the following and having difficulty resolving the error please help. i have
Hi everyone I'm having difficulty understanding the following function structures. Could somebody walk me
I've inherited the following Perl code, and I'm having difficulty understanding what exactly the
Can I do the following without having to learn any version control systems? branch
Having difficulty indexing an attachment type in elasticsearch via the Tire gem. Not able

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.