I have followed the directions in the help item titled: "Handling CRUD Errors with an SQL Data Source" in the 2009.2 online documentation and have the following problems:
1) When a database error occurs, the grid does not restore to the original values even though the click event handler for the OK button in the dialog does fire and is run successfully.
2) Once an error has been traded once, any attempt at updating a value in the grid causes an exception to be thrown by the IG controls and no updates are posted:
Server Error in '/' Application.--------------------------------------------------------------------------------
Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.] Infragistics.Web.UI.LayoutControls.DialogWindowBot.LoadClientObjects(Object[] objects) +71 Infragistics.Web.UI.Framework.ObjectBase.LoadClientState(Object[] oData) +202 Infragistics.Web.UI.Framework.RunBot.HandleOnInit(HttpContext context) +294 Infragistics.Web.UI.Framework.ControlMain.OnInit(EventArgs e) +158 System.Web.UI.Control.InitRecursive(Control namingContainer) +333 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378Client side code is:
nbsp; <script type="text/javascript" id="igClientScript"><!--function Button3_onclick() { var dialog = $find("WebDialogWindow1"); var grid = igtbl_getGridById("UltraWebGrid1"); grid.Rows.refresh(); dialog.hide();} function UltraWebGrid1_XmlHTTPResponseHandler(gridName, rowId, gridResponse){ var xmlResponseObject = gridResponse; var grid = igtbl_getGridById(gridName);
if (xmlResponseObject.ReqType == igtbl_reqType.UpdateRow || xmlResponseObject.ReqType == igtbl_reqType.AddNewRow || xmlResponseObject.ReqType == igtbl_reqType.DeleteRow ) { if (xmlResponseObject.ResponseStatus == 1) { var dialog = $find("WebDialogWindow1"); var contentDiv = document.getElementById("ErrorDiv"); contentDiv.innerHTML = xmlResponseObject.StatusMessage; dialog.show(); } }}
Server Side Code:
Private Sub HandleError(ByVal e As SqlDataSourceStatusEventArgs) If e.Exception IsNot Nothing Then ' This information is available during the client side ' UltraWebGrid1_XmlHTTPResponseHandler event
' Set response status so client will know the status of update Me.UltraWebGrid1.ClientResponse.ResponseStatus = XmlHTTPResponseStatus.Fail
' The exception detail Me.UltraWebGrid1.ClientResponse.StatusMessage = e.Exception.Message
' The custom message for the client can be stored in the tag of the response Me.UltraWebGrid1.ClientResponse.Tag = _ "Update was not successful, check exception details for further information"
e.ExceptionHandled = True Else Me.UltraWebGrid1.ClientResponse.Tag = "The process worked" End If End Sub
Private Sub SqlDataSource1_Deleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Deleted HandleError(e) End Sub
Private Sub SqlDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Inserted HandleError(e) End Sub
Private Sub SqlDataSource1_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Updated HandleError(e) End
Any help would be appreciated,
Dana