Editable "GridView" like management in ASP.NET MVC

I am trying to create an Editable GridView, for example, a control (order column) with this code in the view:

<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Order
        </th>
        <th>
            <img alt="Save order" src="<%= Url.Content("~/Content/minisave.png") %>" />
        </th>
        <th></th>
    </tr>

<% foreach (var item in Model) { %>

    <tr>
        <td>
            <%= Html.Encode(item.Name) %>
        </td>
        <td colspan="2">
            <%= Html.TextBox("Order", item.Order, new { size = "3" }) %>
        </td>
        <td>
            <%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> |
            <%= Html.ActionLink("Details", "Details", new { id=item.id })%>
        </td>
    </tr>

<% } %>

</table>

The table of results looks like this:

alt text

Questions : How do I get this data in my controller? Do I need a form tag around the table? How do I know which Order value belongs to which record?

A few additional questions . If you see the code, I add the size attribute to the input tab, but when the browser displays it, the input is larger, how can I fix it?

Thank you for your help!

+3
source share
1 answer

. , ID . , , .

, , , , , , .

ajax , - Google Spreadsheet, ?

+2

Source: https://habr.com/ru/post/1704979/


All Articles