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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:37:14+00:00 2026-05-21T22:37:14+00:00

I want to post a form data which has grid kind of layout and

  • 0

I want to post a form data which has grid kind of layout and a column in each row contains dropdownlist. selected value in the dropdown list maps to item id of that row.

I want to know what are the different ways to post this data to controller action in this case?

Passing as individual parameters is already ignored option as my form will have dynamic data and it may have n number of records. Am I correct in this thinking?

Thought of FormCollection, is this right choice?

  • 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-21T22:37:15+00:00Added an answer on May 21, 2026 at 10:37 pm

    As always I would start by defining a view model:

    public class MyViewModel
    {
        public string SelectedValue { get; set; }
        public IEnumerable<SelectListItem> Values { get; set; }
    }
    

    then have a GET controller action which will populate a collection of this view model and in the corresponding view I would use editor templates:

    @model IEnumerable<MyViewModel>
    @using (Html.BeginForm())
    {
        <table>
            <thead>
                <tr>
                    <th>Some column name</th>
                </tr>
           </thead>
            <tbody>
                @Html.EditorForModel()
            </tbody>
        </table>
    
        <input type="submit value="OK" />
    }
    

    and in the corresponding editor template (~/Views/Shared/EditorTemplates/MyViewModel.cshtml):

    @model MyViewModel
    <tr>
        <td>
            @Html.DropDownListFor(
                x => x.SelectedValue,
                new SelectList(Model.Values, "Value", "Text")
            )
        </td>
    </tr>
    

    and finally this will post the selected values:

    [HttpPost]
    public ActionResult Index(IEnumerable<MyViewModel> model)
    {
        ...    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jquery looks like this $.post('JSP/processForm.jsp', $(#Form).serialize(), function(data){ //I want to iterate through every line
I have a page which has lot of post data in the url. For
I have a view which validates data from a form which just has some
I have a form-1 which has 4 fields. when the user inputs data in
I want a form which has two submit buttons. The form has some hidden
I want to ignore the post form in the django's internatonalization. I am using
I want to post some values from a simple HTML form, validate them with
I want to make a form like this, and i want to post the
I want to post a forma poupup window. Problem is, the form posts successfully
I have a nested json. I want to post it as a form input

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.