Articles in this section

How to get edited record values in save action in datatable binding?

User Guide Template for Concepts and Features Section

You can get the edited record values in save action by using FormCollection and also get the column names from the HttpContext.Request.Form. Refer the following code example.

Controller 

[AcceptVerbs(HttpVerbs.Post)]

        public ActionResult saveAction(FormCollection collection)

        {

            string ColName = HttpContext.Request.Form.AllKeys[8]; /* you can get all the key values from HttpContext */

            DataTable table1 = GetDatatable();

            table1.Rows.Find(Convert.ToDecimal(collection["OrderID"])).SetField("ShipCity", Convert.ToString(collection["ShipCity"]));

            table1.Rows.Find(Convert.ToDecimal(collection["OrderID"])).SetField("ShipAddress", Convert.ToString(collection["ShipAddress"]));

            table1.AcceptChanges();

            return table1.AsEnumerable().Take(50).GridJSONActions<System.Data.DataRow>();

        }
Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied