I have a GridView with a LinqDataSource attached to it. I want to control the "Row not found or changed" exception alerting the user that the record he's trying to update has been modified by someone else.
At the 'OnUpdated' method of the LinqDataSource, I can handle the exception by doing this:
protected void LDS_Updated(object sender, LinqDataSourceStatusEventArgs e)
{
if (e.Exception != null && e.Exception.HResult == -2146233088)
{
ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "Row not found or changed", "alert('Row not found or changed');", true);
}
}
The problem is that a JavaScript exception is raised and the alert does not appear, as you can see in my Firebug console:
https://i.stack.imgur.com/18F30.png
How can I avoid that JavaScript error and show my 'alert'? Thanks in advance!