I did a bit of reading about ErrorTemplates and things related to WebDataGrids. I am able to write the error message to the ErrorTemplate and throw exceptions and to get the exception (as a whole) to the JavaScript dialog, but the desired state would be something like this:
1) Client deletes a row by clicking delete key.
2) We catch RowsDeleting event and some checks for the rows being deleted.
3) If rows should not be deleted, we cancel the delete event and notify the user about this.
The notification part seems to be quite hidden somewhere in the bowels of the WebDataGrid. How can I access it and implement step three?
protected void WebDataGrid1_RowsDeleting(object sender, Infragistics.Web.UI.GridControls.RowDeletingEventArgs e) {
{
if (e.Row.Items[i].Column.Key == "something") {
if (e.Row.Items[i].Value.ToString().Equals("else"))
e.Cancel = true;
// SHOW ERROR FOR THE USER!
...
Well, in the end I managed to do everything by using CustomAJAXResponse...
Hello AriV,
You can cancel the row updating event on the server side and call RegisterClientScriptBlock() method to display a notification on the client. For row updating are you enabling AJAX on the grid for this scenario?
Let me know if you have any questions with this matter. Thank you.
I am using Infragistics4.Web.v10.3 10.3.20103.2134. I use mainly IE8 and Chrome for testing.
So what you are saying is that when I cancel the updating or inserting event I cannot catch the cancel event on client side? If I want to do some rule checking (for example: a row with identical value in column x exists) and notify the client about this... the only way to do is to make the checking on client side in the first place? What is the preferred way? To make a web service call?
When you cancel the “RowUpdating” event the updating process is canceled and the changes made were not sent to the Datasource. This means that the old values are returned to the grid - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/Infragistics4.Web.v10.3~Infragistics.Web.UI.GridControls.WebDataGrid~RowUpdating_EV.html
Can you tell me what version and build number of our controls do you use and what is the Internet browser that you use for testing?
I am waiting for your response.
I am getting somewhere here by using the client side events. When the RowDeleting event gets triggered on server side I can catch the cancel in RowDeleted event on client side. However, when I try to do the same in RowUpdating or RowAdding, first the client side RowUpdating triggers. Because we don't have anything from server we cannot do any checks here. Then the server RowUpdating triggers where I say e.Cancel = true; That's the end of the story. No more events anywhere.
How should I deal with the matter?
I have the client side events defined and the functions are in place with debugger; and alert('foo'); so the events wouldn't slip past me. The server side events have breakpoints and e.Cancel = true; and I can see them execute.