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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:02:00+00:00 2026-05-28T14:02:00+00:00

So I took some advice to create a DropDownListFor element in my view, which

  • 0

So I took some advice to create a DropDownListFor element in my view, which meant to create a model view called

MODEL
class StudentModelView.

I have two properties.

StudentID{get;set;}
IEnumerable<SelectListItem> SelectPeopleList { get;set;}

I get the list to populate nicely with this code

VIEW

    @Html.DropDownListFor(x => x.StudentID, Model.SelectPeopleList,"--Select Students--", new Dictionary<string,object>{ {"class","dropdowns"},{"id","selectPeopleDDL"}})  

//NEED A BUTTON TO SUBMIT 

CONTROLLER

 public ActionResult Index()
        {


            return View(new StudentModelView());
        }  
  1. What kind of button do I need to make it post
  2. After posting, how do I update my view to show the new filtered list? Am I missing a POST controller or just ajax? What’s the best approach?
  • 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-28T14:02:00+00:00Added an answer on May 28, 2026 at 2:02 pm

    You could do it all using jquery, but here is couple of pointers:

    You should wrap your filter in a form:

    @using (Html.BeginForm("Home", "Index", FormMethod.Get))
    {
      @Html.DropDownListFor(x => x.StudentID, Model.SelectPeopleList,"--Select Students--", new Dictionary<string,object>{ {"class","dropdowns"},{"id","selectPeopleDDL"}})
      <input type="submit" value="Go" />
    }
    

    the submit button is not a must, you could just use jquery to submit whenever the value of the dropdown changes

    in your controller:

    public ActionMethod Index(int? studentID)
    {
      var model = new StudentModelView 
      {
        StudentId = studentID, 
        SelectPeopleList=GetListFiltered(studentId)  
      }
    
      return(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I took some code from my C# Windows form app which uses the Application
So, I took some code from this Microsoft provided Example which allows me to
I took some code here: Check if role consists of particular user in DB?
I found this statement is some old code and it took me a second
I took a data structures class in C++ last year, and consequently implemented all
I took a Computer Graphics exam a couple of days ago which had extra
We have a legacy VB6 app, which is critical to our business. We're working
I'm debugging calls into a specific class, and have set a breakpoint on every
I have two images that are very similar. So for example suppose I drew
I am trying to build a simple vertical thermometer with CSS. I took some

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.