Hi Ruslan,
In order to perform bulk update rather than separate update for each row, we would suggest you to use Excel-like Edit feature. The Essential Grid provides support for Excel-like Edit for all editable fields. This feature offers cell in-line editing, cell selection and row selection. Please have a look at the below online sample,
http://samples.syncfusion.com/ASPNET/7.2.0.37/web/grid.grouping.web/samples/3.5/CRUDOperations/ExcelLikeEdit/cs/excellikeedit.aspxSince the ExcelEditMode works as a client side feature, the values can be updated into data base by manually. ExcelEditAutoUpdate property enables the AutoUpdate option for the updated values into the Grid and in order to update into data base, we need to manually retrieve the Grid rows and to update them. Please refer a code snippet to update Grid rows into data base via button click.
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "";
SqlConnection sqlconnection = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Suppliers.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlCommand sqlcommand;
foreach (TableRow row in this.GridGroupingControl1.TopLevelTable.Rows)
{
if (row is GridRow)
{
GridRow gridRow = row as GridRow;
if (gridRow.Record != null)
{
sqlconnection.Open();
sqlcommand = new SqlCommand("UPDATE SuppliersData SET CompanyName = '" + gridRow.Record.GetValue("CompanyName").ToString() + "', ContactName = '" + gridRow.Record.GetValue("ContactName").ToString() + "', ContactTitle = '" + gridRow.Record.GetValue("ContactTitle").ToString() + "' WHERE SupplierID = '" + Convert.ToInt32(gridRow.Record.GetValue("SupplierID")) + "'", sqlconnection);
sqlcommand.ExecuteScalar();
sqlconnection.Close();
}
Label1.Text = "Updated into DataBase Successfully !!!";
}
}
}
The steps followed here are
1. Get the TableRow in the TopLevelTable.
2. Check if that Row is GridRow, if so Iterate the Gridcells.
3. Enable Update Command and update all the Grid rows.
Please refer a simple sample illustrating this feature.
http://files.syncfusion.com/support/GGC.Web/7.2.0.37/57355/Sample.zipLet me know if this helps you out.
Thanks,
Rekha