iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I need the ability to prevent a user from leaving row until validation is valid. I tried using the OnRowValidate and the OnAfterExitMode but the events seem to fire once which allows me to validate and display a message but the user is always allowed to leave.
For example, I have a button that creates a new row and defaults data. The user should be able to enter data within the fields and then validation would occur if the user attempts to leave the row, the grid, or even the page. This would ensure that all of the data entered in the grid is valid.
You can utilize the OnRowValidate client-side event of WebGrid for your required scenario.
Simply return false if validation is not valid and vice versa. The snippet code below shows a simple implementation of OnRowValidate client-side event. WebGrid will prevent user from leaving a row if “CompanyName” cell of the edited row is empty.
function WebGrid1_OnRowValidate(rowObject) { var WebGrid1 = ISGetObject("WebGrid1"); var rootTable = WebGrid1.RootTable; var currentRowIndex = rowObject.rowIndex; if (rootTable.GetRow(currentRowIndex).GetCells().GetNamedItem("CompanyName").Text == "") return false; else return true; }
Hope this helps.
You can utilize the OnRowValidate client-side event of WebGrid for your required scenario.Simply return false if validation is not valid and vice versa. The snippet code below shows a simple implementation of OnRowValidate client-side event. WebGrid will prevent user from leaving a row if “CompanyName” cell of the edited row is empty.function WebGrid1_OnRowValidate(rowObject) { var WebGrid1 = ISGetObject("WebGrid1"); var rootTable = WebGrid1.RootTable; var currentRowIndex = rowObject.rowIndex; if (rootTable.GetRow(currentRowIndex).GetCells().GetNamedItem("CompanyName").Text == "") return false; else return true; }Hope this helps.
This doesn't work for my scenario.
I have a button that will add a row to the grid and default data. The user could click this button twice created two rows with default data. The OnRowValidate doesn't fire. I even clicked into the row and went up and down through the two rows and this event didn't fire so no validation occurred.
I'd like to ask you a favor by providing the function that will be fired when user add row(s) to the grid with default data (by clicking the button).
Observing the function will helps to determine why does the OnRowValidate client-side event not fired.
I'd like to ask you a favor by providing the function that will be fired when user add row(s) to the grid with default data (by clicking the button).Observing the function will helps to determine why does the OnRowValidate client-side event not fired.
Sure.
function wtbPageToolbar_OnClick() { try { // Create Inuring AddNewInuring(); } catch (ex) { ShowJSException(ex); } } function AddNewInuring() { try { // Get grid var grdInurings = ISGetObject("<%=this.grdInurings.ClientID%>"); if (grdInurings == null) { return false; } // Create new row var newRow = grdInurings.RootTable.NewRow(); if (newRow == null) { return false; } // Default new row's data grdInurings.ClearSelection(); DefaultNewInuringRow(newRow); newRow.AddPendingChanges(); return true; } catch (ex) { ShowJSException(ex); } } function DefaultNewInuringRow(row) { try { if (row == null) { return; } // Selected var cells = row.GetCells(); if (cells == null) { return; } var selected = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISSELECTED%>"); if (selected != null) { selected.SetValue(false, true); } // Treaty Name var treatyName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>"); if (treatyName != null) { WebGrid_SetFieldText(treatyName, ""); } // Portfolio Name List UpdatePortfolioData(row, null); // Cedant Name var cedantName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CEDANTNAME%>"); if (cedantName != null) { WebGrid_SetFieldText(cedantName, ""); } // Inuring Structure var inuringStructure = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGTYPE_ID%>"); if (inuringStructure != null) { WebGrid_SetDropDownListValue(inuringStructure, "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%>", "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%>"); } // Currency Code var currencyCode = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CURRENCYCODE%>"); if (currencyCode != null) { WebGrid_SetFieldText(currencyCode, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_CURRENCYCODE_DEFAULT_VALUE%>"); } // Occurrency Limit var occurrenceLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_OCCURRENCELIMIT%>"); if (occurrenceLimit != null) { WebGrid_SetFieldText(occurrenceLimit, "0"); } // Attachment var attachment = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENT%>"); if (attachment != null) { WebGrid_SetFieldText(attachment, "0"); } // Risk Limit var riskLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RISKLIMIT%>"); if (riskLimit != null) { WebGrid_SetFieldText(riskLimit, "0"); } // Retention var retention = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RETENTION%>"); if (retention != null) { WebGrid_SetFieldText(retention, "0"); } // Placed var placed = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PLACED%>"); if (placed != null) { WebGrid_SetFieldText(placed, "0"); } // Covered var covered = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERED%>"); if (covered != null) { WebGrid_SetFieldText(covered, "0"); } // Effective Date var effectiveDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%>"); if (effectiveDate != null) { WebGrid_SetFieldText(effectiveDate, ""); } // Expiration Date var expirationDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%>"); if (expirationDate != null) { WebGrid_SetFieldText(expirationDate, ""); } // Premium var premium = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PREMIUM%>"); if (premium != null) { WebGrid_SetFieldText(premium, "0"); } // Coverage Basis var coverageBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERAGEBASISTYPE_ID%>"); if (coverageBasis != null) { WebGrid_SetDropDownListValue(coverageBasis, "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%>", "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%>"); } // Attachment Basis var attachmentBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENTBASISTYPE_ID%>"); if (attachmentBasis != null) { WebGrid_SetDropDownListValue(attachmentBasis, "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%>", "<%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%>"); } // Priority var priority = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PRIORITY%>"); if (priority != null) { WebGrid_SetFieldText(priority, "1"); } // Number of Reinstatements var numReinstatements = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_NUMREINSTATEMENTS%>"); if (numReinstatements != null) { WebGrid_SetFieldText(numReinstatements, "1"); } // Reinstatement Charge var reinstatementCharge = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_REINSTATEMENTCHARGE%>"); if (reinstatementCharge != null) { WebGrid_SetFieldText(reinstatementCharge, "0"); } // Source var source = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_SOURCE%>"); if (source != null) { WebGrid_SetFieldText(source, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_SOURCE_USER_DEFAULT_TEXT%>"); } // Inuring Notes var inuringNotes = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGNOTES%>"); if (inuringNotes != null) { WebGrid_SetFieldText(inuringNotes, ""); } // ID // NOTE: This is done to avoid any validation on the DataKeyField being unique var id = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ID%>"); if (id != null) { var now = new Date(); WebGrid_SetFieldText(id, (now.getSeconds() + now.getMilliseconds())); } } catch (ex) { ShowJSException(ex); } } function WebGrid_SetFieldText(field, text, updateValueField) { try { // Set field's text // NOTE: Default the value to the text if not specified if (field == null) { return; } if (typeof (updateValueField) == "undefined") { updateValueField = true; } //var forceNoEdit = field.ForceNoEdit; //field.SetForceNoEdit(false); field.SetText(text, updateValueField); //field.SetForceNoEdit(forceNoEdit); } catch (ex) { ShowJSException(ex); } }
TTT
After observing the function that you use to add the new row, there are two points that I notice. The first one is that you are using BatchUpdate feature on your WebGrid. And the last one is that AddPendingChanges() method is invoked to add the new row from the button click event.
I made a simple test on a WebGrid with BatchUpdate enabled. On the OnRowValidate client-side event of the Grid, I simply put an alert that I use to check whether the OnRowValidate client-side event is fired or not. The test will be made in two scenarios: manually add new row and programmatically add new row by clicking a button (client-side event).
When a new row manually added –this means that I go to the new row and type some value on the cells of the new row; after done, simply press Shift + Enter or Tab on the end of the new row to add the new row–, the OnRowValidate is fired.
When a new row is added by a button click (client-side event) –get the new row object, uses SetText() method on the fields of the new row, and uses AddPendingChanges() to add the new row–, the OnRowValidate is not fired.
It seems that when AddPendingChanges() method is invoked, WebGrid will consider that the user has sure that the changes is valid and directly add the changes to the grid. For this kind of scenario, I’d like to suggest you to add the validation function before invoking the AddPendingChanges() method. If the changes are valid, then the changes will be add to the grid (by invoking AddPendingChanges() method). Else if the changes are invalid, then cancel the changes.
Please let us know your response.
After observing the function that you use to add the new row, there are two points that I notice. The first one is that you are using BatchUpdate feature on your WebGrid. And the last one is that AddPendingChanges() method is invoked to add the new row from the button click event.I made a simple test on a WebGrid with BatchUpdate enabled. On the OnRowValidate client-side event of the Grid, I simply put an alert that I use to check whether the OnRowValidate client-side event is fired or not. The test will be made in two scenarios: manually add new row and programmatically add new row by clicking a button (client-side event).When a new row manually added –this means that I go to the new row and type some value on the cells of the new row; after done, simply press Shift + Enter or Tab on the end of the new row to add the new row–, the OnRowValidate is fired.When a new row is added by a button click (client-side event) –get the new row object, uses SetText() method on the fields of the new row, and uses AddPendingChanges() to add the new row–, the OnRowValidate is not fired.It seems that when AddPendingChanges() method is invoked, WebGrid will consider that the user has sure that the changes is valid and directly add the changes to the grid. For this kind of scenario, I’d like to suggest you to add the validation function before invoking the AddPendingChanges() method. If the changes are valid, then the changes will be add to the grid (by invoking AddPendingChanges() method). Else if the changes are invalid, then cancel the changes.Please let us know your response.
The purpose of the button is to create a new row with the user and default some data. Not all data is defaulted. The user is required to fill in the required fields which is why I am using the OnRowValidate event to ensure the row's data is entered properly. Canceling the changes is not an option as the user has not had the opportunity to complete the row's data.
I made a simple test based on your information regarding the scenario.
In my test page, I added a button that will invoke Button1_onclick() Javascript function. The Button1_onclick() Javascript function is used to set the default value in new row.
Next, after clicking the button, users can add their own data on the fields of the new row. The new row is added after user click Shift + Enter or press Tab button on the last cell of new row. When new row is added, OnRowValidate client-side event is fired.
I enclosed my test page as attachment. Please have the attached sample tested on your end.
I made a simple test based on your information regarding the scenario.In my test page, I added a button that will invoke Button1_onclick() Javascript function. The Button1_onclick() Javascript function is used to set the default value in new row.Next, after clicking the button, users can add their own data on the fields of the new row. The new row is added after user click Shift + Enter or press Tab button on the last cell of new row. When new row is added, OnRowValidate client-side event is fired.I enclosed my test page as attachment. Please have the attached sample tested on your end.
If I modify an existing page in the tutorial with the code above, it works fine.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PreventLeavingRowIfValidationIsInvalid.aspx.cs" Inherits="PreventLeavingRowIfValidationIsInvalid" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Sample File</title> <script language="javascript" type="text/javascript"> <!-- function Button1_onclick() { var grid = ISGetObject("WebGrid1"); var newRowElement = grid.RootTable.GetNewRow(); var newRow = grid.RootTable.ToRowObject(newRowElement); newRow.Select(); var cells = newRow.GetCells(); cells.GetNamedItem("CompanyName").SetText("new company", true); newRow.SetDataChanged(); grid.MarkEdit(); return true; } function WebGrid1_OnRowValidate(rowObject) { //put your validation code in here return true; } --> </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="Add new row" onclick="return Button1_onclick()" /> <ISWebGrid:WebGrid ID="WebGrid1" runat="server" DataSourceID="AccessDataSource1" Height="250px" UseDefaultStyle="True" Width="500px"> <LayoutSettings AllowAddNew="Yes" AllowDelete="Yes" AllowEdit="Yes" AllowBatchUpdate="true"> <BatchUpdateSettings AllowReviewChanges="True" NotifyOnLostFocus="True" /> <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate" /> </LayoutSettings> <RootTable DataKeyField="ShipperID"> <Columns> <ISWebGrid:WebGridColumn Caption="ShipperID" DataMember="ShipperID" DataType="System.Int32" Name="ShipperID" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> </ISWebGrid:WebGrid> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Northwind.mdb" DeleteCommand="DELETE FROM [Shippers] WHERE [ShipperID] = ?" InsertCommand="INSERT INTO [Shippers] ([ShipperID], [CompanyName], [Phone]) VALUES (?, ?, ?)" SelectCommand="SELECT * FROM [Shippers]" UpdateCommand="UPDATE [Shippers] SET [CompanyName] = ?, [Phone] = ? WHERE [ShipperID] = ?"> <DeleteParameters> <asp:Parameter Name="ShipperID" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="ShipperID" Type="Int32" /> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> <asp:Parameter Name="ShipperID" Type="Int32" /> </UpdateParameters> </asp:AccessDataSource> </div> </form> </body> </html>
But, this fails in my page and I cannot figure out why.
The Row.Select() causes an exception: "'type' is null or not an object"
function AddNewInuring() { debugger; var grid = ISGetObject("<%=this.grdInurings.ClientID%>"); // var newRowElement = grid.RootTable.GetNewRow(); // var newRow = grid.RootTable.ToRowObject(newRowElement); var newRow = grid.RootTable.NewRow(); if (newRow == null) { return false; } newRow.Select(); var cells = newRow.GetCells(); cells.GetNamedItem("TreatyName").SetText("new company", true); newRow.SetDataChanged(); grid.MarkEdit(); return true; }
Commenting out Row.Select() method brings up another exception when the Grid's MarkEdit() method: ActiveEditCell.rowElement' is null or not an object
function AddNewInuring() { debugger; var grid = ISGetObject("ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_esScenarioAdjustments_wtScenarioAdjustments_ViewtabInurings_irInurings_wpmPage_ViewContentShell_grdInurings"); // var newRowElement = grid.RootTable.GetNewRow(); // var newRow = grid.RootTable.ToRowObject(newRowElement); var newRow = grid.RootTable.NewRow(); if (newRow == null) { return false; } //newRow.Select(); var cells = newRow.GetCells(); cells.GetNamedItem("TreatyName").SetText("new company", true); newRow.SetDataChanged(); grid.MarkEdit(); return true;
Here's the entire page:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Inurings.ascx.cs" Inherits="Endurance.Re.AWB.Web.AWBWebControls.General.Inurings" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %> <%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolKit" %> <script language="javascript" type="text/javascript"> // <!-- AttachEvent(window, "resize", function() { ForceGridResize(); }); function ForceGridResize() { try { window.setTimeout(function() { wgDoResize(true, true); }, 100); window.setTimeout(function() { wgDoResize(true, true); }, 200); } catch (e) { } } function grdInurings_OnInitialize() { try { // Hide Portfolio ID List after render to allow update at run-time EnduranceGrid_ShowHideColumnByPos("<%=this.grdInurings.ClientID%>", WebGrid_GetColumnIndexByName("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>"), false); } catch (ex) { ShowJSException(ex); } } function wtbPageToolbar_OnClick() { try { // Create Inuring AddNewInuring(); } catch (ex) { ShowJSException(ex); } } function AddNewInuring() { debugger; var grid = ISGetObject("<%=this.grdInurings.ClientID%>"); // var newRowElement = grid.RootTable.GetNewRow(); // var newRow = grid.RootTable.ToRowObject(newRowElement); var newRow = grid.RootTable.NewRow(); if (newRow == null) { return false; } newRow.Select(); var cells = newRow.GetCells(); cells.GetNamedItem("TreatyName").SetText("new company", true); newRow.SetDataChanged(); grid.MarkEdit(); return true; } function asdasd() { try { // Get grid var grdInurings = ISGetObject("<%=this.grdInurings.ClientID%>"); if (grdInurings == null) { return false; } // Create new row var newRow = grdInurings.RootTable.NewRow(); if (newRow == null) { return false; } // Default new row's data grdInurings.ClearSelection(); DefaultNewInuringRow(newRow); newRow.SetDataChanged(); grdInurings.MarkEdit(); // Focus // WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", newRow); //"<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>"); return true; } catch (ex) { ShowJSException(ex); } } function DefaultNewInuringRow(row) { try { if (row == null) { return; } // Selected var cells = row.GetCells(); if (cells == null) { return; } var selected = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISSELECTED%>"); if (selected != null) { selected.SetValue(false, true); } // Treaty Name var treatyName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>"); if (treatyName != null) { WebGrid_SetFieldText(treatyName, ""); } // Portfolio Name List UpdatePortfolioData(row, null); // Cedant Name var cedantName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CEDANTNAME%>"); if (cedantName != null) { WebGrid_SetFieldText(cedantName, ""); } // Inuring Structure var inuringStructure = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGTYPE_ID%>"); if (inuringStructure != null) { WebGrid_SetDropDownListValue(inuringStructure, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); } // Currency Code var currencyCode = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CURRENCYCODE%>"); if (currencyCode != null) { WebGrid_SetFieldText(currencyCode, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_CURRENCYCODE_DEFAULT_VALUE%>"); } // Occurrency Limit var occurrenceLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_OCCURRENCELIMIT%>"); if (occurrenceLimit != null) { WebGrid_SetFieldText(occurrenceLimit, "0"); } // Attachment var attachment = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENT%>"); if (attachment != null) { WebGrid_SetFieldText(attachment, "0"); } // Risk Limit var riskLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RISKLIMIT%>"); if (riskLimit != null) { WebGrid_SetFieldText(riskLimit, "0"); } // Retention var retention = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RETENTION%>"); if (retention != null) { WebGrid_SetFieldText(retention, "0"); } // Placed var placed = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PLACED%>"); if (placed != null) { WebGrid_SetFieldText(placed, "0"); } // Covered var covered = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERED%>"); if (covered != null) { WebGrid_SetFieldText(covered, "0"); } // Effective Date var effectiveDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%>"); if (effectiveDate != null) { WebGrid_SetFieldText(effectiveDate, ""); } // Expiration Date var expirationDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%>"); if (expirationDate != null) { WebGrid_SetFieldText(expirationDate, ""); } // Premium var premium = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PREMIUM%>"); if (premium != null) { WebGrid_SetFieldText(premium, "0"); } // Coverage Basis var coverageBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERAGEBASISTYPE_ID%>"); if (coverageBasis != null) { WebGrid_SetDropDownListValue(coverageBasis, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); } // Attachment Basis var attachmentBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENTBASISTYPE_ID%>"); if (attachmentBasis != null) { WebGrid_SetDropDownListValue(attachmentBasis, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); } // Priority var priority = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PRIORITY%>"); if (priority != null) { WebGrid_SetFieldText(priority, "1"); } // Number of Reinstatements var numReinstatements = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_NUMREINSTATEMENTS%>"); if (numReinstatements != null) { WebGrid_SetFieldText(numReinstatements, "1"); } // Reinstatement Charge var reinstatementCharge = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_REINSTATEMENTCHARGE%>"); if (reinstatementCharge != null) { WebGrid_SetFieldText(reinstatementCharge, "0"); } // Source var source = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_SOURCE%>"); if (source != null) { WebGrid_SetFieldText(source, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_SOURCE_USER_DEFAULT_TEXT%>"); } // Inuring Notes var inuringNotes = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGNOTES%>"); if (inuringNotes != null) { WebGrid_SetFieldText(inuringNotes, ""); } // ID // NOTE: This is done to avoid any validation on the DataKeyField being unique var id = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ID%>"); if (id != null) { var now = new Date(); WebGrid_SetFieldText(id, (now.getSeconds() + now.getMilliseconds())); } } catch (ex) { ShowJSException(ex); } } function grdInurings_OnRowValidate(gridID, tableName, editObject) { try { // Validate Row return ValidateInuringRow(WebGrid_GetSelectedRow("<%=this.grdInurings.ClientID%>")); } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_Validate() { try { var grid = WebGrid_GetGrid("<%=this.grdInurings.ClientID%>"); if (grid == null) { return true; } // Get grid's RowChanges var rowChanges = grid.GetChanges(); if (rowChanges == null) { return true; } // Validate each row for(var index in rowChanges) { var validate = ValidateInuringRow(rowChanges[index].Row); if (validate == false) { return false; } } return true; } catch (ex) { ShowJSException(ex); } } var _fieldToFocus = null; function ValidateInuringRow(row) { try { // Do not validate FilterRow or Deleted rows if (row == null) { return true; } if (row == null || WebGrid_IsCurrentRowFilterRow("<%=this.grdInurings.ClientID%>") == true) { return true; } if (row.GetRowState() == "Deleted") { return true; } // Treaty Name var msg = new Array(); var fieldFocus = null; var cells = row.GetCells(); var treatyNameText = ""; var treatyName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>"); if (treatyName != null && IsNullOrEmpty(treatyName.Value) == true) { msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_TREATYNAME_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = treatyName; } } else { treatyNameText = treatyName.Value; } // Effective Date var effectiveDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%>"); if (effectiveDate != null && IsNullOrEmpty(effectiveDate.Value) == true) { msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EFFECTIVEDATE_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = effectiveDate; } } // Expiration Date var expirationDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%>"); if (expirationDate != null && IsNullOrEmpty(expirationDate.Value) == true) { msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EXPIRATIONDATE_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = expirationDate; } } // Display validation message // NOTE: Add Treaty Name to caption if specified if (msg != null && msg.length > 0) { // Display // NOTE: Select row after display var caption = "<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_VALIDATION_FAILED%>"; if (IsNullOrEmpty(treatyNameText) == false) { caption += " - Treaty " + treatyNameText; } ShowWebDialog(caption, Array_GetList(msg, "<%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%>"), "OK", ShowWebDialog_OnClick) return false; } return true; } catch (ex) { ShowJSException(ex); } } function ShowWebDialog_OnClick() { // Select row // NOTE: This is done after the WebDialog is displayed to ensure row focus is not lost if (_fieldToFocus == null) { return; } WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", _fieldToFocus.Row, _fieldToFocus.Name); _fieldToFocus = null; } function grdInurings_OnRowSelect(controlID, tblName, rowIndex, rowElement) { // Display Portfolio Name List try { ShowPortfolioNameList(); } catch (ex) { ShowJSException(ex); } } function ShowPortfolioNameList() { try { // Do not show data for FilterRow if (WebGrid_IsCurrentRowFilterRow("<%=this.grdInurings.ClientID%>") == true) { ShowPortfolioNameListCallOut(false); return false; } // Display treaty's name and portfolio list // Title var wcoPortfolioNameList = GetPortfolioNameListCallOut(); if (wcoPortfolioNameList == null) { return; } var titlePrefix = "Treaty"; var treatyName = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>"); var title = (IsNullOrEmpty(treatyName) == false) ? titlePrefix + " " + treatyName : titlePrefix; wcoPortfolioNameList.SetTitle(title); // Portfolio Text var textPrefix = "Portfolios:"; var portfolioNameList = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%>"); var text = (IsNullOrEmpty(portfolioNameList) == false) ? textPrefix + " " + portfolioNameList : textPrefix + " None"; wcoPortfolioNameList.SetText(text); wcoPortfolioNameList.Show(); } catch (ex) { ShowJSException(ex); } } function GetPortfolioNameListCallOut() { // Get PortfolioNameList's CallOut try { return ISGetObject("<%=this.wcoPortfolioNameList.ClientID%>"); } catch (ex) { ShowJSException(ex); } } function ShowPortfolioNameListCallOut(show) { try { // Show/Hide var wcoPortfolioNameList = GetPortfolioNameListCallOut(); if (wcoPortfolioNameList == null) { return; } if (show == null) { wcoPortfolioNameList.Show(); } else { wcoPortfolioNameList.Hide(); } } catch (ex) { ShowJSException(ex); } } //================================================================= // Function : grdInurings_OnRowContextMenu // Description : This method will create Context menu based on the // : row. //================================================================= function grdInurings_OnRowContextMenu(controlId, rowType, rowElement, menuObject) { try { // Do not display ContextMenu for FilterRow/ReadOnly rows if (WebGrid_IsFilterRow(rowType) == true) { return false; } var isReadOnly = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISREADONLY%>"); if (isReadOnly.toLowerCase() == "true") { return false; } // Hide default menu items WebGrid_ShowContextMenuItems(menuObject, false); // Manage Portfolios var managePortfolios = new WebMenuItem(); managePortfolios.ImageURL = "..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_EDIT_PATH%>"; managePortfolios.Text = "Manage Portfolios"; managePortfolios.Name = "itmManagePortfolios"; managePortfolios.OnClick = "UpdatePortfolioList"; menuObject.Items.Add(managePortfolios); // Delete Treaty var deleteTreaty = new WebMenuItem(); deleteTreaty.ImageURL = "..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%>"; deleteTreaty.Text = "Delete Treaty"; deleteTreaty.Name = "itmDeleteTreaty"; deleteTreaty.OnClick = "DeleteSelectedInuringRow"; menuObject.Items.Add(deleteTreaty); } catch (ex) { ShowJSException(ex); } } var _rowToUpdate = null; function UpdatePortfolioList() { try { // Persist row to update _rowToUpdate = WebGrid_GetSelectedRow("<%=this.grdInurings.ClientID%>"); // Get currently selected portfolios var selectedPortfolioIDList = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>");; // Load PortfolioPicker to manage portfolios var url = "<%=this.Page.ResolveUrl("~/" + Endurance.Re.AWB.Utility.AWBConstants.PAGE_PORTFOLIOPICKER_PATH)%>"; url += "?<%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_PAGE%>=<%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_SHELL_MENU_TOOLBAR%>"; url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_LOADTYPE%>=<%=Convert.ToInt32(Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.LoadTypes.EDMSnapShotPortfolio)%>"; url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_RETURN_JSFUNCTION_SELPORTFOLIOS%>=UpdateSelectedRowPortfolios"; url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_SELPORTFOLIOS%>=" + selectedPortfolioIDList; url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_ANALYSISSCENARIO_ID%>=<%=base.Page.CurrentAnalysisScenarioID%>"; OpenWindowUnlocked(url, "PortfolioPicker" + "<%=DateTime.Now.Millisecond%>", 1, 610, 415, 10, 10); } catch (ex) { ShowJSException(ex); } } function UpdateSelectedRowPortfolios(selectedPortfolioList) { try { if (_rowToUpdate == null) { return; } // Get grid var grdInurings = ISGetObject("<%=this.grdInurings.ClientID%>"); if (grdInurings == null) { return false; } // Indicate edit is occurring grdInurings.ClearSelection(); _rowToUpdate.Select(); _rowToUpdate.BeginEdit(); UpdatePortfolioData(_rowToUpdate, selectedPortfolioList); // Indicate row's data has been changed and set row stats to edit _rowToUpdate.Update(); _rowToUpdate.SetDataChanged(); _rowToUpdate.AddPendingChanges(); grdInurings.MarkEdit(); // Focus row WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", _rowToUpdate); _rowToUpdate = null; // Show updated portfolio name list ShowPortfolioNameList(); return true; } catch (ex) { ShowJSException(ex); } } function UpdatePortfolioData(row, selectedPortfolioList) { try { // Update portfolio name list if (row == null) { return false; } var rowCells = row.GetCells(); if (rowCells == null) { return; } var portfolioNameList = rowCells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%>"); if (portfolioNameList != null) { var portfolioNameListText = (selectedPortfolioList != null) ? selectedPortfolioList.toStringValues() : ""; WebGrid_SetFieldText(portfolioNameList, portfolioNameListText); } // Update portfolio ID list // NOTE: Convert Hashtable to delimited NameValueObject string var portfolioIDList = rowCells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>"); if (portfolioIDList != null) { WebGrid_SetFieldText(portfolioIDList, NameValueObject_GetString(selectedPortfolioList)); } return true; } catch (ex) { ShowJSException(ex); } } function DeleteSelectedInuringRow() { try { // Delete Treaty WebGrid_DeleteSelectedRow("<%=this.grdInurings.ClientID%>"); // Hide PortfolioNameList CallOut ShowPortfolioNameListCallOut(false); } catch (ex) { ShowJSException(ex); } } // --> </script> <ISWebDesktop:WebPaneManager runat="server" ID="wpmPage" Height="100%" Width="100%" ImagesDirectory="~/Images/WebPaneManager/"> <RootGroupPane Name="RootGroup"> <Panes> <ISWebDesktop:WebPane Name="ToolBarShell" HeaderVisible="No" Height="Custom" HeightValue="32px" AllowCollapse="No" AllowResize="No" ContentScrollable="false"> <ContentTemplate> <table cellpadding="0" cellspacing="0" class="ContentTemplateTopSelectionRegion"> <tr> <td> <ISWebDesktop:WebToolBar runat="server" ID="wtbPageToolbar" Caption="" IntegratedTo="None" NewDockingArea="NotSet" NewDockingRow="0" Width="100%" AllowFloat="No" IsFloat="No" AllowCustomize="No" AllowDockBottom="No" AllowDockLeft="No" AllowDockRight="No" AllowDockTop="No" AllowExpandCollapse="No" AllowMove="No" HandleVisible="No" Height="24px" CommandMargin="2" DockingOffset="0" CommandSize="" HeaderHeight="" MergeToolBarParentID=""> <Commands> <ISWebDesktop:ToolCommand Category="FileMenu" Name="cmdCreateInuring" Text="Create Inuring" AutoPostBack="No" DisplayMode="TextAndImage" Image="~/Images/16x16/wg5_newrow.gif" ToolTip="Create New Inuring"> </ISWebDesktop:ToolCommand> </Commands> <CommandClientSideEvents OnClick="wtbPageToolbar_OnClick" /> <SeparatorStyle CssClass="WebToolBarSeparatorStyle" /> <MenuStyleSettings MenuAnimation="True"> </MenuStyleSettings> <ToggleGroups> <ISWebDesktop:ToggleGroup Name="Browse" /> </ToggleGroups> <BodyStyle BackColor="#BFDBFF" /> <CommandStyle> <Normal CssClass="WebToolBarCommandStyleNormal"> </Normal> <Over CssClass="WebToolBarCommandStyleOver"> </Over> <Active CssClass="WebToolBarCommandStyleActive"> </Active> </CommandStyle> <CommandDisabledStyle CssClass="WebToolBarCommandStyleDisabled"> </CommandDisabledStyle> </ISWebDesktop:WebToolBar> </td> </tr> </table> </ContentTemplate> </ISWebDesktop:WebPane> <ISWebDesktop:WebGroupPane GroupType="VerticalTile" Name="GroupPaneShell"> <Panes> <ISWebDesktop:WebPane Name="ContentShell" Text="Inurings" AllowResize="Yes" ContentMode="UseInlineContent" DiscardContainerStyle="True" ContentScrollable="False" HeaderVisible="No" Height="Custom" HeightValue="100%" Width="Custom" WidthValue="100%"> <ContentTemplate> <div class="ContentTemplateGridContent"> <CommonCtrl:EnduranceWebGrid runat="server" ID="grdInurings" DefaultStyleMode="Elegant" UseDefaultStyle="True" Width="100%" Height="100%" ViewStateItems="All" OnInitializeDataSource="grdInurings_OnInitializeDataSource" OnInitializePostBack="grdInurings_OnInitializePostBack" OnPrepareDataBinding="grdInurings_OnPrepareDataBinding" OnInitializeLayout="grdInurings_OnInitializeLayout" OnInitializeRow="grdInurings_OnInitializeRow" OnUpdateRow="grdInurings_OnUpdateRow" OnExport="grdInurings_OnExport"> <LayoutSettings AutoHeight="false" AutoWidth="false" AllowBatchUpdate="true" BatchUpdateSettings-PromptUnsavedChanges="false" BatchUpdateSettings-AutomaticObjectUpdate="false" AllowEdit="Yes" EditOnClick="True" AllowAddNew="Yes" AllowDelete="Yes" PromptBeforeDelete="true" NewRowLostFocusAction="AlwaysPrompt" ResetNewRowValuesOnError="True" RowHeightDefault="22px" AllowFilter="Yes" AllowSelectColumns="Yes" AllowSorting="Yes" HideColumnsWhenGrouped="Default" AllowExport="Yes" InProgressUIBehavior="ChangeCursorToHourGlass" ApplyFiltersKey="Enter" AllowColumnFreezing="Yes" ShowFilterStatus="True" PagingMode="VirtualLoad" VerboseEditingInformation="False" FilterBarVisible="True" PagingExportMode="ExportAllData" CellPaddingDefault="0" AlwaysShowHelpButton="False" VirtualPageSize="200"> <ClientSideEvents OnInitialize="grdInurings_OnInitialize" OnRowContextMenu="grdInurings_OnRowContextMenu" OnRowValidate="grdInurings_OnRowValidate" OnRowSelect="grdInurings_OnRowSelect" /> <FrameStyle> <BorderSettings> <Top Style="none" /> <Bottom Style="none" /> <Left Color="#6593cf" Width="1" Style="solid" /> <Right Color="#6593cf" Width="1" Style="solid" /> </BorderSettings> </FrameStyle> <HeaderStyle CssClass="WebGridHeaderStyle" /> <StatusBarStyle CssClass="WebGridStatusBarStyle" /> <StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" Normal-CssClass="WebGridStatusBarCommandStyleNormal" Over-CssClass="WebGridStatusBarCommandStyleOver"> <Normal CssClass="WebGridStatusBarCommandStyleNormal"> </Normal> <Over CssClass="WebGridStatusBarCommandStyleOver"> </Over> <Active CssClass="WebGridStatusBarCommandStyleActive"> </Active> </StatusBarCommandStyle> <FilterRowStyle CssClass="WebGridFilterRowStyle" /> <PreviewRowStyle CssClass="WebGridRowStyle" /> <RowStyle CssClass="WebGridRowStyle" /> <QuickFilterBarStyle CssClass="WebGridRowStyle" /> <RowHeaderStyle CssClass="WebGridRowHeaderStyle" /> <SelectedRowStyle CssClass="WebGridSelectedRowStyle" /> <EditFocusCellStyle CssClass="WebGridRowStyle" /> <FocusCellStyle CssClass="WebGridRowStyle" /> <LostFocusRowStyle CssClass="WebGridRowStyle" /> <NewRowStyle CssClass="WebGridRowStyle" /> <SortedColumnStyle CssClass="WebGridSortedColumnStyle" /> <AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" /> <EditTextboxStyle CssClass="WebGridEditTextboxStyle" /> <FreezePaneSettings ActiveFrozenColumns="4" ShowInContextMenu="False" ShowSplitterLine="False" MaxFrozenColumns="4" SplitterLineColor="ActiveBorder" SplitterLineWidth="1" /> </LayoutSettings> <RootTable Caption="Inurings" DataKeyField="ID" NewRowInfoText="Please click here to create a new Inuring"> <Columns> <ISWebGrid:WebGridColumn Caption="ID" Name="ID" DataMember="ID" DataType="System.Integer" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit" Width="0px" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="IsReadOnly" Name="IsReadOnly" DataMember="IsReadOnly" DataType="System.Boolean" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit" Width="0px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Select" Name="IsSelected" DataMember="IsSelected" DataType="System.Boolean" ColumnType="CheckBox" EditType="Checkbox" NewRowEditType="Checkbox" FilterEditType="Checkbox" Width="40px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Treaty Name" Name="TreatyName" DataMember="TreatyName" DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="150px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Portfolio Name" Name="PortfolioNameList" DataMember="PortfolioNameList" DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="PortfolioIDList" Name="PortfolioIDList" DataMember="PortfolioIDList" DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit" Width="0px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Cedant" Name="CedantName" DataMember="CedantName" DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Inuring Structure" Name="InuringTypeID" DataMember="InuringTypeID" DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Currency" Name="CurrencyCode" DataMember="CurrencyCode" DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="70px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Occurrence Limit" Name="OccurrenceLimit" DataMember="OccurrenceLimit" DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Attachment" Name="Attachment" DataMember="Attachment" DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Risk Limit" Name="RiskLimit" DataMember="RiskLimit" DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Retention" Name="Retention" DataMember="Retention" DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="%Placed" Name="Placed" DataMember="Placed" DataType="System.Decimal" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="%Covered" Name="Covered" DataMember="Covered" DataType="System.Decimal" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Effective Date" Name="EffectiveDate" DataMember="EffectiveDate" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo" NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Expiry Date" Name="ExpirationDate" DataMember="ExpirationDate" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo" NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Premium" Name="Premium" DataMember="Premium" DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Coverage Basis" Name="CoverageBasisTypeID" DataMember="CoverageBasisTypeID" DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Attachment Basis" Name="AttachmentBasisTypeID" DataMember="AttachmentBasisTypeID" DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Priority" Name="Priority" DataMember="Priority" DataType="System.DateTime" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="50px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Number of Reinstatements" Name="NumReinstatements" DataMember="NumReinstatements" DataType="System.DateTime" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="150px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Reinstatement Charge" Name="ReinstatementCharge" DataMember="ReinstatementCharge" DataType="System.DateTime" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="125px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Source" Name="Source" DataMember="Source" DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="TextBox" Width="50px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Notes" Name="InuringNotes" DataMember="InuringNotes" DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="300px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> </CommonCtrl:EnduranceWebGrid> </div> </ContentTemplate> </ISWebDesktop:WebPane> </Panes> </ISWebDesktop:WebGroupPane> </Panes> </RootGroupPane> <SplitterStyle> <Normal CssClass="WebPaneManagerSplitterStyleNormal"> </Normal> <Over CssClass="WebPaneManagerSplitterStyleOver" BaseStyle="Normal"> </Over> <Active CssClass="WebPaneManagerSplitterStyleActive" BaseStyle="Normal"> </Active> </SplitterStyle> <PaneSettings PaneSpacing="0"> <ContainerStyle CssClass="WebPaneManagerContainerStyle"> </ContainerStyle> <HeaderMainStyle CssClass="WebPaneManagerHeaderMainStyle"> </HeaderMainStyle> <HeaderSubStyle CssClass="WebPaneManagerHeaderSubStyle"> </HeaderSubStyle> <InfoTextStyle CssClass="WebPaneManagerHeaderInfoTextStyle"> </InfoTextStyle> </PaneSettings> <FrameStyle CssClass="WebPaneManagerFrameStyle"> </FrameStyle> </ISWebDesktop:WebPaneManager> <ISWebDesktop:WebCallOut runat="server" ID="wcoPortfolioNameList" Height="100%" Width="100%" Title="Treaty" Text="" OffsetBottomPointingPosition="-12" OffsetTopPointingPosition="12" EnableInteractiveMoving="true" ShowBehavior="NoFading" CloseBehavior="MouseOut" LayoutMode="Simple" PointingPosition="AutoDetect" />
The newRow.Select() in my sent sample is used to select the “new row” object of the grid. The new object is obtained from the result of ToRowObject(newRowElement) method.
After inspect the AddNewInuring() Javascript function, I found out that you are using grid.RootTable.NewRow(). Please try to use GetNewRow() method to obtain the element of new row. After the element is obtained, please use ToRowObject() method and pass the new row element into the ToRowObject() method.
The newRow.Select() in my sent sample is used to select the “new row” object of the grid. The new object is obtained from the result of ToRowObject(newRowElement) method.After inspect the AddNewInuring() Javascript function, I found out that you are using grid.RootTable.NewRow(). Please try to use GetNewRow() method to obtain the element of new row. After the element is obtained, please use ToRowObject() method and pass the new row element into the ToRowObject() method.Hope this helps.
I replaced the AddNewInuring() JavaScript function with your example word-for-word except the WebGrid name was changed.
The newRow.GetCells() method fails:
"'this.Column.ColumnType' is null or not an object"
I sent you reply through your registered email account.Please kindly check your inbox.
I finally got a chance to review this. There were multiple problems with my code:
grid.MarkEdit(); was done BEFORE the NewRow's Focus() was called causing the ActiveEditCell.rowElement' is null or not an object as I mentioned above. This should be considered a bug and fixed.
The retrieve of the NewRow should use the GetNewRow() method instead of the NewRow() method. It only worked after this was done. Can someone explain the difference?
var newRowElement = grid.RootTable.GetNewRow();var newRow = grid.RootTable.ToRowObject(newRowElement);
instead of
var newRow = grid.RootTable.NewRow();
The NewRow's Focus() must be done BEFORE the WebGrid's MarkEdit() method
The WebGrid.ClearSelection() must be done BEFORE the NewRow's Focus() and the Grid's MarkEdit() method (A row MUST be focused -- Again, not sure why)
Here's an example of the code with some custom methods but the logic flow is clear:
// Get grid var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return false; } // Create new row var newRowElement = grid.RootTable.GetNewRow(); if (newRowElement == null) { return false; } var newRow = grid.RootTable.ToRowObject(newRowElement); if (newRow == null) { return false; } // Focus New Row grid.ClearSelection(); WebGrid_SelectRow(<%=this.ClientID%>_GetGridClientID(), newRow, "<%=Endurance.Re.FWB.Data.Constants.SP_COL_GENIUSCLAIMAMOUNT_CLAIMTITLE%>"); // Default new row's data <%=this.ClientID%>_DefaultClaimRow(newRow); newRow.SetDataChanged(); grid.MarkEdit();
Now, the OnRowValidate event STILL DOESN'T execute as the user tries to leave the row. The only fix I can think of is to take an existing field and update it with the current text to trick the row into thinking it is dirty. Is there a property that allows me to indicate a row or a cell is dirty to force the OnRowValidated event to fire?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname