Hi Jaouen Cécile,
Thanks for using Syncfusion Products.
We regret for the inconvenience caused. We are unable to reproduce your reported issue in our end. We have created a simple sample to demonstrate this and the same can be downloaded from the below link.
sample: JsonDataTable.zip
Could you please replicate your issue in the above sample and send back to us so that we could able to sort out the cause of this issue and provide you a better solutions quickly?.
Please try the above sample and let us know if you have any concerns.
Regards,
Bala Murugan A.S
Hi Laszlo,
Thanks for using Syncfusion products.
We are glad to inform you that your requirement ("I am
having difficulty with getting the Save action working when the Grid is bound
to DataTable.") can be achieved by creating separate class for getting
current record values and we suggest you to use the SetField method to update
the current record values to the DataTable. Please refer the below code
snippets.
CODE SNIPPET:
[CSHTML]
@(Html.Syncfusion().Grid<System.Data.DataRow>("OrdersGrid")
//. . .
.Editing(edit =>
{
edit.AllowEdit(true);
edit.EditMode(GridEditMode.Normal);
edit.PrimaryKey(new string[]{"OrderID"});
})
.Mappers(map =>
{
map.SaveAction("OrderSave");
})
)
[CS]
public ActionResult OrderSave(OrderClass order)
{
var dataTabl = GetTable();
dataTabl.Rows.Find(order.OrderID).SetField("CustomerID",
order.CustomerID);
dataTabl.Rows.Find(order.OrderID).SetField("OrderDate",
order.OrderDate);
dataTabl.Rows.Find(order.OrderID).SetField("ShipCity",
order.ShipCity);
dataTabl.Rows.Find(order.OrderID).SetField("ShipPostalCode",
order.ShipPostalCode);
dataTabl.AcceptChanges();
return
dataTabl.AsEnumerable().GridJSONActions<System.Data.DataRow>();
}
public DataTable GetTable()
{
var connection = ConfigurationManager.ConnectionStrings["NORTHWNDConnectionString"].ConnectionString;
using (var dataAdapter = new SqlDataAdapter("SELECT *
from Orders", connection))
{
var dataTable = new DataTable();
dataAdapter.Fill(dataTable);
DataColumn[] key = new DataColumn[1];
key[0] = dataTable.Columns["OrderID"];
dataTable.PrimaryKey = key;
return dataTable;
}
}
For your convenience, we have prepared a simple sample to
demonstrate this and the same can be downloaded from the below link,
Link: SampleProject.zip
Please let us know if you need any further assistance.
Regards,
Silambarasan I