Inline Edit data on MVCContrib grid and save bulk chanegs

1k views Asked by At

I am using "MvcContrib.Mvc4" to show my grid on a page in my project.

I need to have a grid with some columns which are from filtered data (From Source table), and have 3 in-line editable column, like StartDate, EndDate, Notes and need to insert them into new table(The Destination Table)

I can use the Html.EditorFor(c=>c.StartDate) in my columns, and edit them on the grid, but I don't know how to track the changes and save their updates into data base!

Also I have the column of "Notes" which is not in the model, but I need to insert it into new table with the other changed data (To the destination table)

After I edited data, in the source of page, the value is not changed.

I need to give the user the ability of editing (these three columns) on many rows and after submitting the "Save" button, Save bulk changes from grid into another new table!

I am thinking of a way to get changes and send them all to server by client side code like Jquery or Ajax, But I could not find any good example of this on internet.

I know how to check boxes on the grid and get the selected ids form the page, but I don't know how to get changed Text fields and Dates from grid.

I appreciate any help or sample code!

Here are some codes

@Html.Grid(Model.Enrolments).WithModel(new EnrolmentGrid()).Columns(column =>
{
    column.For(i => Html.EditorFor(x => i.EndDate)).Named("End Date");
    column.For(i => Html.EditorFor(x => i.StartDate)).Named("Start Date");
    column.For(i => Html.Editor("Notes", new { /*Not sure if this is correct*/ value = i.EnrolmentId, @class = "Notes" })).Named("Notes");

}).Attributes(@class => "full-grid-style")}
0

There are 0 answers