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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:28:07+00:00 2026-06-12T18:28:07+00:00

I displayed a list of data in form of a grid [basic html table]

  • 0

I displayed a list of data in form of a grid [basic html table] and placed text boxes so that we can edit inside the grid and post the values so that I can save it. The list is not big , around 5-10 rows in it.

How to access these form values back in controller? FormCollection doesn’t seem to work and I cannot even access the values through Request.Form[]. I want it back in a form of a list so that I can loop through it and get the new values.

.cshtml

 <form action="/Parameter/StudentWeights" method="post">
     <table>
    <tr>
        <th>
            Category
        </th>
        <th>
            CategoryAlias
        </th>

        <th>
            YearCode
        </th>
          <th>
            ClassKto8
        </th>
        <th>
            Class9to12
        </th>
        <th></th>
    </tr>
    @foreach(var item in Model.StudentWeights) {
    <tr>
    <td>
            @Html.HiddenFor(modelItem => item.CategoryId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Category)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CategoryAlias)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.YearCode)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.ClassKto8)
        </td>
         <td>
            @Html.EditorFor(modelItem => item.Class9to12)
        </td>

    </tr>
}

</table>
<input type="submit" value = "Submit" />
 </form>

controller

[HttpPost]
public ActionResult studentWeights(FormCollection collection)
{
    try
    {
        // TODO: Add update logic here

        //service.
        foreach (var item in collection)
        { 
            int x = item. // i want to loop through it and access the values.
        }
    }
    catch
    {
        return View();
    }
}

please help me how to get these values. I don’t want to use JEditable or any third party jQuery tools.

Is there any way to create a custom type and assign values in JavaScript or jQuery upon button click and then send it to my controller action?

Thank you very much, any suggestion would be much helpful.

  • 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-06-12T18:28:08+00:00Added an answer on June 12, 2026 at 6:28 pm

    You need to access the form collection differently. The form collection is a key value pair of the values posted to the controller. formcollection[“postvalue”]

    [HttpPost]
    public ActionResult studentWeights(FormCollection formCollection)
    {
        foreach (string _formData in formCollection)
        {
            var x = formCollection[_formData];
        }
    
    }
    

    Here are several way to iterate through a form collection
    http://stack247.wordpress.com/2011/03/20/iterate-through-system-web-mvc-formcollection/

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

Sidebar

Related Questions

I have a long list of data that I want to display in table
I have a SQLite database that is displayed in a data grid view in
I have a list of states, each with some data associated with it, displayed
Are there any implementations to display nicely table or list data in c# console
I have a webpage that displays a very large list of data. Since this
I am trying to create a list box that displays a set of data
I have a c# windows form that pulls a generic list on load using
I have an app that retrieves data from a webservice in the form of
I am currently working on a data input form that will take as in
Is it possible to store the display list data on the video card memory?

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.