ASP.NET MVC 1: DataSet ModelBinding -
I am in a situation where I am being given a dataset for output in a MVC view. I am really struggling to know how the modelbender can get the way to get it back after submitting it. I have something like this ...
Public Action TestData () {DataSet Data = New Dataset ("DS"); Datatyal table = new datatable ("DT"); Data.Tables.Add (table); Table Columns Add ("id", typef (int)); Table Columns Add ("name", typef (string)); Table. road. Add (1, "John"); Table. road. Add (2, "Mark"); Table. road. Add (3, "Paul"); Table. road. Add (4, "Chris"); See Return (data); } [AcceptVerbs (HttpVerbs.Post)] Public Functional Test Data (Dataset Data) {Return View (Data); }
On the page I have tried many names for the input elements but it has no use. Is it also possible that I would be using a view-model type if it was possible, but unfortunately it is completely dynamic structure and the most natural thing to use is a dataset.
If it were mine, then I would sort the rows into hidden areas, which have the same name attribute is. Maybe
& lt; Something like input type = "hidden" name = "dsRows" value = "[id] _ [name]" />
Then another action (which accepts the post) ), Accept a string [] as a parameter. You can then use it to "detonate" the array in a little LINQ query or a dataset.
(Note: I have not tested this specifically, but I've used the strategy many times)
Comments
Post a Comment