Hi,
I use the "try...catch" in order to save the data to the server.
And I was exception handling in the "throw ex".
However, this doesn't display page when an error occurs.
So I have to debug to check the exception message.
In such a case, do I need to process How?
here my code.
aspx
aspx.cs
I use the "try...catch" in order to save the data to the server.
And I was exception handling in the "throw ex".
However, this doesn't display page when an error occurs.
So I have to debug to check the exception message.
In such a case, do I need to process How?
here my code.
aspx
<title></title> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function Update() { var batchManager = grid2.get_batchEditingManager(); batchManager.saveChanges(grid2.get_masterTableView()); }......<body> <form id="form" runat="server"> <div> <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Height="100%" Width="100%" HorizontalAlign="NotSet" OnAjaxRequest="RadAjaxPanel2_AjaxRequest"> <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" Culture="ko-KR" GroupPanelPosition="Top" OnNeedDataSource="RadGrid2_NeedDataSource" OnBatchEditCommand="RadGrid2_BatchEditCommand" OnItemCreated="RadGrid2_ItemCreated" Height="445px" OnPreRender="RadGrid2_PreRender" AllowAutomaticUpdates="True" ShowFooter="True"> <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowKeyboardNavigation="True"> <ClientEvents OnRowCreated="RowCreated" OnBatchEditCellValueChanged="RadGrid2_OnBatchEditCellValueChanged" /> <KeyboardNavigationSettings AllowSubmitOnEnter="True" CancelChangesKey="D1" /> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> </ClientSettings> <MasterTableView EditMode="Batch" BatchEditingSettings-EditType="Cell"> <Columns>............aspx.cs
.................... protected override void OnPreInit(EventArgs e) { baseScriptManager = new ScriptManager(); baseScriptManager.AsyncPostBackTimeout = 600; Page.Items[typeof(ScriptManager)] = baseScriptManager; base.OnPreInit(e); } protected override void OnPreLoad(EventArgs e) { Page.Items[typeof(ScriptManager)] = null; baseScriptManager.AllowCustomErrorsRedirect = true; baseScriptManager.AsyncPostBackError += this.baseScriptManager_AsyncPostBackError; this.Form.Controls.Add(baseScriptManager); base.OnPreLoad(e); } private void baseScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e) { baseScriptManager.AsyncPostBackErrorMessage = e.Exception.Message; } protected void RadGrid2_BatchEditCommand(object sender, GridBatchEditingEventArgs e) { ................ using (DbConnection connection = db.CreateConnection()) { connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { DbCommand dbCommand = null; foreach (DBParameter DBParameter in parameters) { dbCommand = db.GetStoredProcCommand("uspw_test1"); dbCommand.CommandTimeout = commandTimeout; if (DBParameter != null) { foreach (Parameter parameter in DBParameter.ListParameter) db.AddInParameter(dbCommand, parameter.Name, parameter.DBType, parameter.Value); } result += db.ExecuteNonQuery(dbCommand, transaction); } // Commit the transaction transaction.Commit(); } catch (System.Exception ex) { // Rollback transaction transaction.Rollback(); throw ex; } connection.Close(); return; } }