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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:20:53+00:00 2026-05-11T13:20:53+00:00

In ASP.net MVC: How should/Can I pass Form data (From the View) to the

  • 0

In ASP.net MVC:

How should/Can I pass Form data (From the View) to the Controller?

This is the way I am heading :

  • The Controller Index function is passing a ViewModel object to the View.
  • The ViewModel object contains a paginated list as well as some SelectLists. _ The ViewModel object also contains a custom class I named theFilter. This class’ purpose is to hold the Filter information Posted from the View via a Form.
  • I want the Index [AcceptVerbs(HttpVerbs.Post)] function to receive theFilter object populated with the form data, as well as the page number (as is it right now)

Here are snippets of my code:

The Controller/Index postback function:

    [AcceptVerbs(HttpVerbs.Post)]     public ActionResult Index(int? page, CaseFilter caseFilter)     {         const int pageSize = 10;         var cases = caseRepo.FindAllCases();         var paginatedCases = new PaginatedList<Case>(cases, page ?? 0, pageSize);         return View(new CaseIndexViewModel(paginatedCases, caseFilter));     } 

The Filter Class:

public class CaseFilter {     int iVolume_id = 0,         iSubject_id = 0;      public CaseFilter() {      }      public int Volume_id { get { return iVolume_id; } set { iVolume_id = value; } }     public int Subject_id { get { return iSubject_id; } set { iSubject_id = value; } }  } 

And the ViewModel class:

    public class CaseIndexViewModel     {     public PaginatedList<Case> PaginatedCases { get; private set; }     public CaseFilter CaseFilter { get; private set; }      public CaseIndexViewModel(PaginatedList<Case> paginatedCases, CaseFilter caseFilter)     {         PaginatedCases = paginatedCases;        CaseFilter = caseFilter;     } } 

Basically I am trying to avoid using Request.Form to populate the Filter class, at least not to use it within the Controller.

Any help, suggestions or disses are welcome!

  • 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. 2026-05-11T13:20:54+00:00Added an answer on May 11, 2026 at 1:20 pm

    Finally, I do not need to even use the Request Collection. The CaseFilter object is filled automatically as I set it as a parameter in

    public ActionResult Index(int? page, CaseFilter caseFilter) 

    The code above works as it is.

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

Sidebar

Related Questions

How can i create a sub-controller in ASP.NET MVC? i.e: In controller's directory i
Duplicate: Should I pursue ASP.NET WebForms or ASP.NET MVC? We are developing an enterprise
We should have a full release of asp.net MVC well before .NET 4.0 and
ASP.NET MVC has been discussed on this forum a few times. I'm about to
ASP.NET MVC - what is this in VB.NET? Html.TextBox( name, null, new { @class
Using ASP.NET MVC there are situations (such as form submission) that may require a
In ASP.NET MVC it's possible to choice between having a typed view were you
With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one
Short: how does modelbinding pass objects from view to controller? Long: First, based on
I have a ASP.net MVC application that gets marker coordinates from a database (I

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.