﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Wed, 01 Dec 2010 12:54:00 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;p&gt;I finally got a chance to review this.  There were multiple problems with my code:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;span style="font-size: 13px"&gt;&lt;p&gt;grid.MarkEdit();&amp;nbsp;was done BEFORE the NewRow's Focus() was called causing the ActiveEditCell.rowElement' is null or not an object as I mentioned above.&amp;nbsp; This should be considered a bug and fixed.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The&amp;nbsp;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?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;var newRowElement = grid.RootTable.GetNewRow();&lt;br /&gt;var newRow = grid.RootTable.ToRowObject(newRowElement);&lt;/p&gt;&lt;p&gt;instead of&amp;nbsp;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;var newRow = grid.RootTable.NewRow();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The NewRow's Focus() must be done BEFORE the WebGrid's MarkEdit() method&lt;/p&gt;&lt;p&gt;The WebGrid.ClearSelection()&amp;nbsp;must be done BEFORE the NewRow's Focus() and the Grid's MarkEdit() method (A row MUST be focused -- Again, not sure why)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here's an example of the code with some custom methods but the logic flow is clear:&lt;/p&gt;&lt;pre&gt;        // Get grid
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_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(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID(), newRow, "&amp;lt;%=Endurance.Re.FWB.Data.Constants.SP_COL_GENIUSCLAIMAMOUNT_CLAIMTITLE%&amp;gt;");
             
        // Default new row's data		        
        &amp;lt;%=this.ClientID%&amp;gt;_DefaultClaimRow(newRow);
        newRow.SetDataChanged();
        grid.MarkEdit();  &lt;/pre&gt;&lt;p&gt;Now, the OnRowValidate event STILL DOESN'T execute as the user tries to leave the row.&amp;nbsp;&amp;nbsp; 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?&lt;/p&gt;&lt;/span&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Fri, 24 Sep 2010 03:20:28 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;I sent you reply through your registered email account.&lt;br /&gt;Please kindly check your inbox.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Thu, 23 Sep 2010 09:21:19 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I replaced the AddNewInuring() JavaScript function with your example word-for-word except the WebGrid name was changed.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;The newRow.GetCells() method fails:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;"'this.Column.ColumnType' is null or not an object"&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Thu, 23 Sep 2010 00:42:13 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Wed, 22 Sep 2010 11:56:20 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;I made a simple test based on your information regarding the scenario.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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 &amp;#43; Enter or press Tab button on the last cell of new row. When new row is added, OnRowValidate client-side event is fired.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;I enclosed my test page as attachment. Please have the attached sample tested on your end.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;If I modify an existing page in the tutorial with the code above, it works fine.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="PreventLeavingRowIfValidationIsInvalid.aspx.cs"
    Inherits="PreventLeavingRowIfValidationIsInvalid" %&amp;gt;

&amp;lt;%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Sample File&amp;lt;/title&amp;gt;
    &amp;lt;script language="javascript" type="text/javascript"&amp;gt;
        &amp;lt;!--
        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;
        }
        --&amp;gt;
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;input id="Button1" type="button" value="Add new row" onclick="return Button1_onclick()" /&amp;gt;
        &amp;lt;ISWebGrid:WebGrid ID="WebGrid1" runat="server" DataSourceID="AccessDataSource1"
            Height="250px" UseDefaultStyle="True" Width="500px"&amp;gt;
            &amp;lt;LayoutSettings AllowAddNew="Yes" AllowDelete="Yes" AllowEdit="Yes" AllowBatchUpdate="true"&amp;gt;
                &amp;lt;BatchUpdateSettings AllowReviewChanges="True" NotifyOnLostFocus="True" /&amp;gt;
                &amp;lt;ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate" /&amp;gt;
            &amp;lt;/LayoutSettings&amp;gt;
            &amp;lt;RootTable DataKeyField="ShipperID"&amp;gt;
                &amp;lt;Columns&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn Caption="ShipperID" DataMember="ShipperID" DataType="System.Int32"
                        Name="ShipperID" Width="100px"&amp;gt;
                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName"
                        Width="100px"&amp;gt;
                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px"&amp;gt;
                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                &amp;lt;/Columns&amp;gt;
            &amp;lt;/RootTable&amp;gt;
        &amp;lt;/ISWebGrid:WebGrid&amp;gt;
        &amp;lt;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] = ?"&amp;gt;
            &amp;lt;DeleteParameters&amp;gt;
                &amp;lt;asp:Parameter Name="ShipperID" Type="Int32" /&amp;gt;
            &amp;lt;/DeleteParameters&amp;gt;
            &amp;lt;InsertParameters&amp;gt;
                &amp;lt;asp:Parameter Name="ShipperID" Type="Int32" /&amp;gt;
                &amp;lt;asp:Parameter Name="CompanyName" Type="String" /&amp;gt;
                &amp;lt;asp:Parameter Name="Phone" Type="String" /&amp;gt;
            &amp;lt;/InsertParameters&amp;gt;
            &amp;lt;UpdateParameters&amp;gt;
                &amp;lt;asp:Parameter Name="CompanyName" Type="String" /&amp;gt;
                &amp;lt;asp:Parameter Name="Phone" Type="String" /&amp;gt;
                &amp;lt;asp:Parameter Name="ShipperID" Type="Int32" /&amp;gt;
            &amp;lt;/UpdateParameters&amp;gt;
        &amp;lt;/asp:AccessDataSource&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;But, this fails in my page and I cannot figure out why.  &lt;/p&gt;
&lt;p&gt;The Row.Select() causes an exception: "'type' is null or not an object" &lt;/p&gt;&lt;pre&gt;function AddNewInuring() 
    {
        debugger;
        var grid = ISGetObject("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
        // 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;
    }&lt;/pre&gt;

&lt;p&gt; Commenting out Row.Select() method brings up another exception when the Grid's MarkEdit() method: ActiveEditCell.rowElement' is null or not an object&lt;/p&gt;&lt;pre&gt;    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;
    &amp;nbsp;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here's the entire page:&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Inurings.ascx.cs" Inherits="Endurance.Re.AWB.Web.AWBWebControls.General.Inurings" %&amp;gt;

&amp;lt;%@ Register Assembly="ISNet.WebUI.WebGrid"                  Namespace="ISNet.WebUI.WebGrid"     TagPrefix="ISWebGrid"    %&amp;gt;
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebDesktop"               Namespace="ISNet.WebUI.WebDesktop"  TagPrefix="ISWebDesktop" %&amp;gt;
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebInput"                 Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput"   %&amp;gt;
&amp;lt;%@ Register Assembly="AjaxControlToolkit"                   Namespace="AjaxControlToolkit"      TagPrefix="ajaxToolKit"  %&amp;gt;

&amp;lt;script language="javascript" type="text/javascript"&amp;gt;
// &amp;lt;!--
    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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", WebGrid_GetColumnIndexByName("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%&amp;gt;"), false);
        }
        catch (ex) { ShowJSException(ex); }
    }
        
    function wtbPageToolbar_OnClick() 
    {
        try 
        {
            // Create Inuring
            AddNewInuring();
        }
        catch (ex) { ShowJSException(ex); }
    }

    function AddNewInuring() 
    {
        debugger;
        var grid = ISGetObject("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
        // 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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
            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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", newRow);
            //"&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%&amp;gt;");
                            
            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("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISSELECTED%&amp;gt;");
            if (selected != null) { selected.SetValue(false, true); }   
            
            // Treaty Name             
            var treatyName = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%&amp;gt;");
            if (treatyName != null) { WebGrid_SetFieldText(treatyName, ""); }
            
            // Portfolio Name List            
            UpdatePortfolioData(row, null);
            
            // Cedant Name
            var cedantName = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CEDANTNAME%&amp;gt;");
            if (cedantName != null) { WebGrid_SetFieldText(cedantName, ""); }
            
            // Inuring Structure
            var inuringStructure = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGTYPE_ID%&amp;gt;");
            if (inuringStructure != null) 
            { 
                WebGrid_SetDropDownListValue(inuringStructure, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;"); 
            }
            
            // Currency Code
            var currencyCode = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CURRENCYCODE%&amp;gt;");
            if (currencyCode != null) { WebGrid_SetFieldText(currencyCode, "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.INURING_CURRENCYCODE_DEFAULT_VALUE%&amp;gt;"); }
            
            // Occurrency Limit            
            var occurrenceLimit = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_OCCURRENCELIMIT%&amp;gt;");
            if (occurrenceLimit != null) { WebGrid_SetFieldText(occurrenceLimit, "0"); }
            
            // Attachment
            var attachment = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENT%&amp;gt;");
            if (attachment != null) { WebGrid_SetFieldText(attachment, "0"); }
            
            // Risk Limit
            var riskLimit = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RISKLIMIT%&amp;gt;");
            if (riskLimit != null) { WebGrid_SetFieldText(riskLimit, "0"); }
             
            // Retention
            var retention = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RETENTION%&amp;gt;");
            if (retention != null) { WebGrid_SetFieldText(retention, "0"); }
            
            // Placed
            var placed = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PLACED%&amp;gt;");
            if (placed != null) { WebGrid_SetFieldText(placed, "0"); }
            
            // Covered
            var covered = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERED%&amp;gt;");
            if (covered != null) { WebGrid_SetFieldText(covered, "0"); }
            
            // Effective Date
            var effectiveDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%&amp;gt;");
            if (effectiveDate != null) { WebGrid_SetFieldText(effectiveDate, ""); }
            
            // Expiration Date
            var expirationDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%&amp;gt;");
            if (expirationDate != null) { WebGrid_SetFieldText(expirationDate, ""); }
            
            // Premium
            var premium = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PREMIUM%&amp;gt;");
            if (premium != null) { WebGrid_SetFieldText(premium, "0"); }
            
            // Coverage Basis
            var coverageBasis = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERAGEBASISTYPE_ID%&amp;gt;");
            if (coverageBasis != null) 
            { 
                WebGrid_SetDropDownListValue(coverageBasis, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;"); 
            }
            
            // Attachment Basis
            var attachmentBasis = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENTBASISTYPE_ID%&amp;gt;");
            if (attachmentBasis != null) 
            { 
                WebGrid_SetDropDownListValue(attachmentBasis, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;"); 
            }
            
            // Priority
            var priority = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PRIORITY%&amp;gt;");
            if (priority != null) { WebGrid_SetFieldText(priority, "1"); }
            
            // Number of Reinstatements
            var numReinstatements = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_NUMREINSTATEMENTS%&amp;gt;");
            if (numReinstatements != null) { WebGrid_SetFieldText(numReinstatements, "1"); }
            
            // Reinstatement Charge
            var reinstatementCharge = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_REINSTATEMENTCHARGE%&amp;gt;");
            if (reinstatementCharge != null) { WebGrid_SetFieldText(reinstatementCharge, "0"); }
            
            // Source
            var source = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_SOURCE%&amp;gt;");
            if (source != null) { WebGrid_SetFieldText(source, "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.INURING_SOURCE_USER_DEFAULT_TEXT%&amp;gt;"); } 
            
            // Inuring Notes
            var inuringNotes = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGNOTES%&amp;gt;");
            if (inuringNotes != null) { WebGrid_SetFieldText(inuringNotes, ""); }
            
            // ID
            // NOTE: This is done to avoid any validation on the DataKeyField being unique
            var id = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ID%&amp;gt;");
            if (id != null) 
            {
                var now = new Date();
	            WebGrid_SetFieldText(id, (now.getSeconds() &amp;#43; now.getMilliseconds()));
            }
        }
        catch (ex) { ShowJSException(ex); }              
    }        
    
    function grdInurings_OnRowValidate(gridID, tableName, editObject)
    {
        try 
        { 
            // Validate Row   
            return ValidateInuringRow(WebGrid_GetSelectedRow("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;"));
        }
        catch (ex) { ShowJSException(ex); }
    }
    
    function &amp;lt;%=this.ClientID%&amp;gt;_Validate() 
    { 
        try
        {
            var grid = WebGrid_GetGrid("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
            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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;") == 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("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%&amp;gt;");
            if (treatyName != null &amp;amp;&amp;amp; IsNullOrEmpty(treatyName.Value) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_TREATYNAME_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = treatyName; }
            }
            else { treatyNameText = treatyName.Value; }                                                           
                        
            // Effective Date
            var effectiveDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%&amp;gt;");
            if (effectiveDate != null &amp;amp;&amp;amp; IsNullOrEmpty(effectiveDate.Value) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EFFECTIVEDATE_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = effectiveDate; }
            }  
                        
            // Expiration Date
            var expirationDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%&amp;gt;");
            if (expirationDate != null &amp;amp;&amp;amp; IsNullOrEmpty(expirationDate.Value) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EXPIRATIONDATE_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = expirationDate; }                
            }  
            
            // Display validation message
            // NOTE: Add Treaty Name to caption if specified
            if (msg != null &amp;amp;&amp;amp; msg.length &amp;gt; 0)
            {
                // Display
                // NOTE: Select row after display       
                var caption = "&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_VALIDATION_FAILED%&amp;gt;";
                if (IsNullOrEmpty(treatyNameText) == false) { caption &amp;#43;= " - Treaty " &amp;#43; treatyNameText; }
                ShowWebDialog(caption, Array_GetList(msg, "&amp;lt;%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%&amp;gt;"), "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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", _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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;") == 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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%&amp;gt;");
            var title = (IsNullOrEmpty(treatyName) == false) ? titlePrefix &amp;#43; " " &amp;#43; treatyName : titlePrefix;
            wcoPortfolioNameList.SetTitle(title);
            
            // Portfolio Text
            var textPrefix = "Portfolios:";
            var portfolioNameList = WebGrid_GetSelectedRowFieldText("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%&amp;gt;");
            var text = (IsNullOrEmpty(portfolioNameList) == false) ? textPrefix &amp;#43; " " &amp;#43; portfolioNameList : textPrefix &amp;#43; " None";
            wcoPortfolioNameList.SetText(text);
            wcoPortfolioNameList.Show();
        }
        catch (ex) { ShowJSException(ex); }
    }       
    
    function GetPortfolioNameListCallOut()
    {
        // Get PortfolioNameList's CallOut
        try { return ISGetObject("&amp;lt;%=this.wcoPortfolioNameList.ClientID%&amp;gt;"); }
        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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISREADONLY%&amp;gt;");
            if (isReadOnly.toLowerCase() == "true") { return false; }        

            // Hide default menu items
            WebGrid_ShowContextMenuItems(menuObject, false);                                  
            
            // Manage Portfolios
            var managePortfolios = new WebMenuItem();
            managePortfolios.ImageURL = "..&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.IMAGE_EDIT_PATH%&amp;gt;";
            managePortfolios.Text = "Manage Portfolios";
            managePortfolios.Name = "itmManagePortfolios";
            managePortfolios.OnClick = "UpdatePortfolioList";
            menuObject.Items.Add(managePortfolios);
            
            // Delete Treaty
            var deleteTreaty = new WebMenuItem();
            deleteTreaty.ImageURL = "..&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%&amp;gt;";
            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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
            
            // Get currently selected portfolios 
            var selectedPortfolioIDList = WebGrid_GetSelectedRowFieldText("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%&amp;gt;");;
            
            // Load PortfolioPicker to manage portfolios
            var url = "&amp;lt;%=this.Page.ResolveUrl("~/" &amp;#43; Endurance.Re.AWB.Utility.AWBConstants.PAGE_PORTFOLIOPICKER_PATH)%&amp;gt;";
            url &amp;#43;= "?&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_PAGE%&amp;gt;=&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_SHELL_MENU_TOOLBAR%&amp;gt;";
            url &amp;#43;= "&amp;amp;&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_LOADTYPE%&amp;gt;=&amp;lt;%=Convert.ToInt32(Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.LoadTypes.EDMSnapShotPortfolio)%&amp;gt;";
            url &amp;#43;= "&amp;amp;&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_RETURN_JSFUNCTION_SELPORTFOLIOS%&amp;gt;=UpdateSelectedRowPortfolios";
            url &amp;#43;= "&amp;amp;&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_SELPORTFOLIOS%&amp;gt;=" &amp;#43; selectedPortfolioIDList;
            url &amp;#43;= "&amp;amp;&amp;lt;%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_ANALYSISSCENARIO_ID%&amp;gt;=&amp;lt;%=base.Page.CurrentAnalysisScenarioID%&amp;gt;";
            OpenWindowUnlocked(url, "PortfolioPicker" &amp;#43; "&amp;lt;%=DateTime.Now.Millisecond%&amp;gt;", 1, 610, 415, 10, 10);
        }
        catch (ex) { ShowJSException(ex); }
    }
        
    function UpdateSelectedRowPortfolios(selectedPortfolioList)
    {
        try
        {
            if (_rowToUpdate == null) { return; }
            
            // Get grid
            var grdInurings = ISGetObject("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
            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("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;", _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("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%&amp;gt;");
            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("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%&amp;gt;");
            if (portfolioIDList != null) 
            {                 
                WebGrid_SetFieldText(portfolioIDList, NameValueObject_GetString(selectedPortfolioList));
            } 
                        
            return true;
        }
        catch (ex) { ShowJSException(ex); }            
    }  
    
    function DeleteSelectedInuringRow()
    {
        try 
        { 
            // Delete Treaty
            WebGrid_DeleteSelectedRow("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;"); 
            
            // Hide PortfolioNameList CallOut
            ShowPortfolioNameListCallOut(false);
        }
        catch (ex) { ShowJSException(ex); }
    }   
                
// --&amp;gt;
&amp;lt;/script&amp;gt;

&amp;lt;ISWebDesktop:WebPaneManager runat="server" ID="wpmPage" Height="100%" Width="100%"
    ImagesDirectory="~/Images/WebPaneManager/"&amp;gt;
    &amp;lt;RootGroupPane Name="RootGroup"&amp;gt;
        &amp;lt;Panes&amp;gt;
            &amp;lt;ISWebDesktop:WebPane Name="ToolBarShell" HeaderVisible="No" Height="Custom" HeightValue="32px"
                AllowCollapse="No" AllowResize="No" ContentScrollable="false"&amp;gt;
                &amp;lt;ContentTemplate&amp;gt;
                    &amp;lt;table cellpadding="0" cellspacing="0" class="ContentTemplateTopSelectionRegion"&amp;gt;
                        &amp;lt;tr&amp;gt;
                            &amp;lt;td&amp;gt;
                                &amp;lt;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=""&amp;gt;
                                    &amp;lt;Commands&amp;gt;
                                        &amp;lt;ISWebDesktop:ToolCommand Category="FileMenu" Name="cmdCreateInuring" Text="Create Inuring"
                                            AutoPostBack="No" DisplayMode="TextAndImage" Image="~/Images/16x16/wg5_newrow.gif"
                                            ToolTip="Create New Inuring"&amp;gt;
                                        &amp;lt;/ISWebDesktop:ToolCommand&amp;gt;
                                    &amp;lt;/Commands&amp;gt;
                                    &amp;lt;CommandClientSideEvents OnClick="wtbPageToolbar_OnClick" /&amp;gt;
                                    &amp;lt;SeparatorStyle CssClass="WebToolBarSeparatorStyle" /&amp;gt;
                                    &amp;lt;MenuStyleSettings MenuAnimation="True"&amp;gt;
                                    &amp;lt;/MenuStyleSettings&amp;gt;
                                    &amp;lt;ToggleGroups&amp;gt;
                                        &amp;lt;ISWebDesktop:ToggleGroup Name="Browse" /&amp;gt;
                                    &amp;lt;/ToggleGroups&amp;gt;
                                    &amp;lt;BodyStyle BackColor="#BFDBFF" /&amp;gt;
                                    &amp;lt;CommandStyle&amp;gt;
                                        &amp;lt;Normal CssClass="WebToolBarCommandStyleNormal"&amp;gt;
                                        &amp;lt;/Normal&amp;gt;
                                        &amp;lt;Over CssClass="WebToolBarCommandStyleOver"&amp;gt;
                                        &amp;lt;/Over&amp;gt;
                                        &amp;lt;Active CssClass="WebToolBarCommandStyleActive"&amp;gt;
                                        &amp;lt;/Active&amp;gt;
                                    &amp;lt;/CommandStyle&amp;gt;
                                    &amp;lt;CommandDisabledStyle CssClass="WebToolBarCommandStyleDisabled"&amp;gt;
                                    &amp;lt;/CommandDisabledStyle&amp;gt;
                                &amp;lt;/ISWebDesktop:WebToolBar&amp;gt;
                            &amp;lt;/td&amp;gt;
                        &amp;lt;/tr&amp;gt;
                    &amp;lt;/table&amp;gt;
                &amp;lt;/ContentTemplate&amp;gt;
            &amp;lt;/ISWebDesktop:WebPane&amp;gt;
            &amp;lt;ISWebDesktop:WebGroupPane GroupType="VerticalTile" Name="GroupPaneShell"&amp;gt;
                &amp;lt;Panes&amp;gt;
                    &amp;lt;ISWebDesktop:WebPane Name="ContentShell" Text="Inurings" AllowResize="Yes" ContentMode="UseInlineContent"
                        DiscardContainerStyle="True" ContentScrollable="False" HeaderVisible="No" Height="Custom"
                        HeightValue="100%" Width="Custom" WidthValue="100%"&amp;gt;
                        &amp;lt;ContentTemplate&amp;gt;
                            &amp;lt;div class="ContentTemplateGridContent"&amp;gt;
                                &amp;lt;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"&amp;gt;
                                    &amp;lt;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"&amp;gt;
                                        &amp;lt;ClientSideEvents OnInitialize="grdInurings_OnInitialize" OnRowContextMenu="grdInurings_OnRowContextMenu"
                                            OnRowValidate="grdInurings_OnRowValidate" OnRowSelect="grdInurings_OnRowSelect" /&amp;gt;
                                        &amp;lt;FrameStyle&amp;gt;
                                            &amp;lt;BorderSettings&amp;gt;
                                                &amp;lt;Top Style="none" /&amp;gt;
                                                &amp;lt;Bottom Style="none" /&amp;gt;
                                                &amp;lt;Left Color="#6593cf" Width="1" Style="solid" /&amp;gt;
                                                &amp;lt;Right Color="#6593cf" Width="1" Style="solid" /&amp;gt;
                                            &amp;lt;/BorderSettings&amp;gt;
                                        &amp;lt;/FrameStyle&amp;gt;
                                        &amp;lt;HeaderStyle CssClass="WebGridHeaderStyle" /&amp;gt;
                                        &amp;lt;StatusBarStyle CssClass="WebGridStatusBarStyle" /&amp;gt;
                                        &amp;lt;StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" Normal-CssClass="WebGridStatusBarCommandStyleNormal"
                                            Over-CssClass="WebGridStatusBarCommandStyleOver"&amp;gt;
                                            &amp;lt;Normal CssClass="WebGridStatusBarCommandStyleNormal"&amp;gt;
                                            &amp;lt;/Normal&amp;gt;
                                            &amp;lt;Over CssClass="WebGridStatusBarCommandStyleOver"&amp;gt;
                                            &amp;lt;/Over&amp;gt;
                                            &amp;lt;Active CssClass="WebGridStatusBarCommandStyleActive"&amp;gt;
                                            &amp;lt;/Active&amp;gt;
                                        &amp;lt;/StatusBarCommandStyle&amp;gt;
                                        &amp;lt;FilterRowStyle CssClass="WebGridFilterRowStyle" /&amp;gt;
                                        &amp;lt;PreviewRowStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;RowStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;QuickFilterBarStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;RowHeaderStyle CssClass="WebGridRowHeaderStyle" /&amp;gt;
                                        &amp;lt;SelectedRowStyle CssClass="WebGridSelectedRowStyle" /&amp;gt;
                                        &amp;lt;EditFocusCellStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;FocusCellStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;LostFocusRowStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;NewRowStyle CssClass="WebGridRowStyle" /&amp;gt;
                                        &amp;lt;SortedColumnStyle CssClass="WebGridSortedColumnStyle" /&amp;gt;
                                        &amp;lt;AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" /&amp;gt;
                                        &amp;lt;EditTextboxStyle CssClass="WebGridEditTextboxStyle" /&amp;gt;
                                        &amp;lt;FreezePaneSettings ActiveFrozenColumns="4" ShowInContextMenu="False" ShowSplitterLine="False"
                                            MaxFrozenColumns="4" SplitterLineColor="ActiveBorder" SplitterLineWidth="1" /&amp;gt;
                                    &amp;lt;/LayoutSettings&amp;gt;
                                    &amp;lt;RootTable Caption="Inurings" DataKeyField="ID" NewRowInfoText="Please click here to create a new Inuring"&amp;gt;
                                        &amp;lt;Columns&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="ID" Name="ID" DataMember="ID" DataType="System.Integer"
                                                ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit"
                                                Width="0px" Visible="false"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="IsReadOnly" Name="IsReadOnly" DataMember="IsReadOnly"
                                                DataType="System.Boolean" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="NoEdit" Width="0px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Select" Name="IsSelected" DataMember="IsSelected"
                                                DataType="System.Boolean" ColumnType="CheckBox" EditType="Checkbox" NewRowEditType="Checkbox"
                                                FilterEditType="Checkbox" Width="40px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Treaty Name" Name="TreatyName" DataMember="TreatyName"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="150px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Portfolio Name" Name="PortfolioNameList" DataMember="PortfolioNameList"
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="PortfolioIDList" Name="PortfolioIDList" DataMember="PortfolioIDList"
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="NoEdit" Width="0px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Cedant" Name="CedantName" DataMember="CedantName"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Inuring Structure" Name="InuringTypeID" DataMember="InuringTypeID"
                                                DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Currency" Name="CurrencyCode" DataMember="CurrencyCode"
                                                DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="70px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Occurrence Limit" Name="OccurrenceLimit" DataMember="OccurrenceLimit"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Attachment" Name="Attachment" DataMember="Attachment"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Risk Limit" Name="RiskLimit" DataMember="RiskLimit"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Retention" Name="Retention" DataMember="Retention"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="%Placed" Name="Placed" DataMember="Placed" DataType="System.Decimal"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="%Covered" Name="Covered" DataMember="Covered" DataType="System.Decimal"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;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"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;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"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Premium" Name="Premium" DataMember="Premium" DataType="System.Integer"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Coverage Basis" Name="CoverageBasisTypeID" DataMember="CoverageBasisTypeID"
                                                DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Attachment Basis" Name="AttachmentBasisTypeID"
                                                DataMember="AttachmentBasisTypeID" DataType="System.Integer" ColumnType="Custom"
                                                EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList"
                                                Width="100px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Priority" Name="Priority" DataMember="Priority"
                                                DataType="System.DateTime" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="50px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Number of Reinstatements" Name="NumReinstatements"
                                                DataMember="NumReinstatements" DataType="System.DateTime" ColumnType="Text" EditType="TextBox"
                                                NewRowEditType="TextBox" FilterEditType="TextBox" Width="150px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Reinstatement Charge" Name="ReinstatementCharge"
                                                DataMember="ReinstatementCharge" DataType="System.DateTime" ColumnType="Text"
                                                EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="125px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Source" Name="Source" DataMember="Source" DataType="System.String"
                                                ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="TextBox"
                                                Width="50px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                            &amp;lt;ISWebGrid:WebGridColumn Caption="Notes" Name="InuringNotes" DataMember="InuringNotes"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="300px"&amp;gt;
                                            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                        &amp;lt;/Columns&amp;gt;
                                    &amp;lt;/RootTable&amp;gt;
                                &amp;lt;/CommonCtrl:EnduranceWebGrid&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;/ContentTemplate&amp;gt;
                    &amp;lt;/ISWebDesktop:WebPane&amp;gt;
                &amp;lt;/Panes&amp;gt;
            &amp;lt;/ISWebDesktop:WebGroupPane&amp;gt;
        &amp;lt;/Panes&amp;gt;
    &amp;lt;/RootGroupPane&amp;gt;
    &amp;lt;SplitterStyle&amp;gt;
        &amp;lt;Normal CssClass="WebPaneManagerSplitterStyleNormal"&amp;gt;
        &amp;lt;/Normal&amp;gt;
        &amp;lt;Over CssClass="WebPaneManagerSplitterStyleOver" BaseStyle="Normal"&amp;gt;
        &amp;lt;/Over&amp;gt;
        &amp;lt;Active CssClass="WebPaneManagerSplitterStyleActive" BaseStyle="Normal"&amp;gt;
        &amp;lt;/Active&amp;gt;
    &amp;lt;/SplitterStyle&amp;gt;
    &amp;lt;PaneSettings PaneSpacing="0"&amp;gt;
        &amp;lt;ContainerStyle CssClass="WebPaneManagerContainerStyle"&amp;gt;
        &amp;lt;/ContainerStyle&amp;gt;
        &amp;lt;HeaderMainStyle CssClass="WebPaneManagerHeaderMainStyle"&amp;gt;
        &amp;lt;/HeaderMainStyle&amp;gt;
        &amp;lt;HeaderSubStyle CssClass="WebPaneManagerHeaderSubStyle"&amp;gt;
        &amp;lt;/HeaderSubStyle&amp;gt;
        &amp;lt;InfoTextStyle CssClass="WebPaneManagerHeaderInfoTextStyle"&amp;gt;
        &amp;lt;/InfoTextStyle&amp;gt;
    &amp;lt;/PaneSettings&amp;gt;
    &amp;lt;FrameStyle CssClass="WebPaneManagerFrameStyle"&amp;gt;
    &amp;lt;/FrameStyle&amp;gt;
&amp;lt;/ISWebDesktop:WebPaneManager&amp;gt;
&amp;lt;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" /&amp;gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Wed, 22 Sep 2010 05:25:45 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I made a simple test based on your information regarding the scenario.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;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 &amp;#43; Enter or press Tab button on the last cell of new row. When new row is added, OnRowValidate client-side event is fired.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I enclosed my test page as attachment. Please have the attached sample tested on your end.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Tue, 21 Sep 2010 10:32:55 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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 &amp;#43; Enter or Tab on the end of the new row to add the new row–, the OnRowValidate is fired.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; color: #1f497d; font-family: 'segoe ui','sans-serif'"&gt;Please let us know your response.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;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.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Mon, 20 Sep 2010 23:03:58 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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 &amp;#43; Enter or Tab on the end of the new row to add the new row–, the OnRowValidate is fired.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Please let us know your response.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Mon, 20 Sep 2010 14:18:35 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;p&gt;TTT&lt;/p&gt;</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Thu, 16 Sep 2010 15:31:14 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;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).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Observing the function will helps to determine why does the OnRowValidate client-side event not fired.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Sure.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;pre&gt;function wtbPageToolbar_OnClick() 
    {
        try 
        {
            // Create Inuring
            AddNewInuring();
        }
        catch (ex) { ShowJSException(ex); }
    }

    function AddNewInuring()
    {
        try 
        {
            // Get grid
            var grdInurings = ISGetObject("&amp;lt;%=this.grdInurings.ClientID%&amp;gt;");
            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("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISSELECTED%&amp;gt;");
            if (selected != null) { selected.SetValue(false, true); }   
            
            // Treaty Name             
            var treatyName = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%&amp;gt;");
            if (treatyName != null) { WebGrid_SetFieldText(treatyName, ""); }
            
            // Portfolio Name List            
            UpdatePortfolioData(row, null);
            
            // Cedant Name
            var cedantName = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CEDANTNAME%&amp;gt;");
            if (cedantName != null) { WebGrid_SetFieldText(cedantName, ""); }
            
            // Inuring Structure
            var inuringStructure = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGTYPE_ID%&amp;gt;");
            if (inuringStructure != null) 
            { 
                WebGrid_SetDropDownListValue(inuringStructure, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%&amp;gt;"); 
            }
            
            // Currency Code
            var currencyCode = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CURRENCYCODE%&amp;gt;");
            if (currencyCode != null) { WebGrid_SetFieldText(currencyCode, "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.INURING_CURRENCYCODE_DEFAULT_VALUE%&amp;gt;"); }
            
            // Occurrency Limit            
            var occurrenceLimit = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_OCCURRENCELIMIT%&amp;gt;");
            if (occurrenceLimit != null) { WebGrid_SetFieldText(occurrenceLimit, "0"); }
            
            // Attachment
            var attachment = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENT%&amp;gt;");
            if (attachment != null) { WebGrid_SetFieldText(attachment, "0"); }
            
            // Risk Limit
            var riskLimit = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RISKLIMIT%&amp;gt;");
            if (riskLimit != null) { WebGrid_SetFieldText(riskLimit, "0"); }
             
            // Retention
            var retention = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RETENTION%&amp;gt;");
            if (retention != null) { WebGrid_SetFieldText(retention, "0"); }
            
            // Placed
            var placed = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PLACED%&amp;gt;");
            if (placed != null) { WebGrid_SetFieldText(placed, "0"); }
            
            // Covered
            var covered = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERED%&amp;gt;");
            if (covered != null) { WebGrid_SetFieldText(covered, "0"); }
            
            // Effective Date
            var effectiveDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%&amp;gt;");
            if (effectiveDate != null) { WebGrid_SetFieldText(effectiveDate, ""); }
            
            // Expiration Date
            var expirationDate = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%&amp;gt;");
            if (expirationDate != null) { WebGrid_SetFieldText(expirationDate, ""); }
            
            // Premium
            var premium = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PREMIUM%&amp;gt;");
            if (premium != null) { WebGrid_SetFieldText(premium, "0"); }
            
            // Coverage Basis
            var coverageBasis = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERAGEBASISTYPE_ID%&amp;gt;");
            if (coverageBasis != null) 
            { 
                WebGrid_SetDropDownListValue(coverageBasis, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%&amp;gt;"); 
            }
            
            // Attachment Basis
            var attachmentBasis = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENTBASISTYPE_ID%&amp;gt;");
            if (attachmentBasis != null) 
            { 
                WebGrid_SetDropDownListValue(attachmentBasis, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_VALUE_SELECT%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.DROPDOWN_ID_SELECT%&amp;gt;"); 
            }
            
            // Priority
            var priority = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PRIORITY%&amp;gt;");
            if (priority != null) { WebGrid_SetFieldText(priority, "1"); }
            
            // Number of Reinstatements
            var numReinstatements = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_NUMREINSTATEMENTS%&amp;gt;");
            if (numReinstatements != null) { WebGrid_SetFieldText(numReinstatements, "1"); }
            
            // Reinstatement Charge
            var reinstatementCharge = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_REINSTATEMENTCHARGE%&amp;gt;");
            if (reinstatementCharge != null) { WebGrid_SetFieldText(reinstatementCharge, "0"); }
            
            // Source
            var source = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_SOURCE%&amp;gt;");
            if (source != null) { WebGrid_SetFieldText(source, "&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.INURING_SOURCE_USER_DEFAULT_TEXT%&amp;gt;"); } 
            
            // Inuring Notes
            var inuringNotes = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGNOTES%&amp;gt;");
            if (inuringNotes != null) { WebGrid_SetFieldText(inuringNotes, ""); }
            
            // ID
            // NOTE: This is done to avoid any validation on the DataKeyField being unique
            var id = cells.GetNamedItem("&amp;lt;%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ID%&amp;gt;");
            if (id != null) 
            {
                var now = new Date();
	            WebGrid_SetFieldText(id, (now.getSeconds() &amp;#43; 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); }
}&lt;/pre&gt;
</description></item><item><title>How to prevent user from leaving row if validation failed?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-prevent-user-from-leaving-row-if-validation-failed/</link><pubDate>Wed, 15 Sep 2010 17:27:01 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;</description></item></channel></rss>