Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit tabular data (ASP MVC)

I need to be able to edit a table of data in the browser.

I have seen in MVCContrib there is a HTML helper to render out a table. Useful... but what about if I want the user to be able to edit that table? From what I can see it does not help there.

What is the best way to approach this?

Traditional FORM with a TABLE inside? If so is MVC smart enough to parse the posted data back into a collection of rows? How would that work anyway?

Or perhaps it should just switch to edit mode when a row is clicked (using javascript etc) then when user moves to a different row an AJAX action is called to submit just the one row. I can imagine the logic could get complex here - this would presumably still use a form but would I have to insert it into the DOM dynamically?

I also need to be able to add rows to this table. I do not require paging support.

Is there an off the shelf solution out there?

Should I go back to web forms? :)

like image 400
Jack Ukleja Avatar asked May 23 '09 13:05

Jack Ukleja


People also ask

What is WebGrid in ASP NET MVC?

In ASP.NET MVC, the new concept begins WebGrid. WebGrid is lightweight for showing data in report format. As you know, MVC is all about Model View Controller, in this article we will learn how to create a WebGrid and search data and show it in a WebGrid with Entity Framework.


1 Answers

Take a look at Phil Haack's blog where he describes how to model bind to a list.

Maybe this can help?

like image 101
BengtBe Avatar answered Sep 21 '22 01:09

BengtBe