Hi John,
You can use your custom sql query in DataSourceControlRowUpdating event, which occurs before updating a record in the bound DataSourceControl. Please refer the sample code snippet below to achieve this.
protected void GridGroupingControl1_DataSourceControlRowUpdating(object sender, GridDataSourceControlRowUpdateEventArgs e)
{
e.Cancel = true; //This will cancel the normal update in the datasource
//e will have all the values of the column in the Grid.
// your custom sql update query can be put up here.
e.Handled = true; //This will update the changes of the DataBase to the Grid.
}
If your intension is to know the row state when it is created, added, modified, and deleted, we would suggest you use SelectedRecordsChanged event in which the SelectedRecordsChangedType enumeration is returned by the Action property of the SelectedRecords.
void GridGroupingControl1_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{
if (e.Action == SelectedRecordsChangedType.Added)
{
}
}
Also you can use GridRowEditUpdateLink's OnClick event to trigger GridRowEditUpdateEventArgs which determines the type of the CommandLink. The command link type can be checked for:
NewRecord,
Insert,
Delete,
Edit,
Update,
Cancel
Please refer the code snippet below to achieve this.
[ASPX]
[C#]
protected void RowEditUpdate(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridRowEditUpdateEventArgs e)
{
Label1.Text = "";
if (e.CommandLinkType == "Update")
{
Label1.Text = "Update Link is clicked";
}
if (e.CommandLinkType == "Cancel")
{
Label1.Text = "Cancel Link is clicked";
}
if (e.CommandLinkType == "Edit")
{
Label1.Text = "Edit Link is clicked";
}
}
Sample:
http://files.syncfusion.com/support/GGC.Web/7.2.0.37/57673/Sample.zipPlease let me know if you have any concerns.
Thanks,
Rekha