﻿<?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 delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</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 delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Thu, 09 Dec 2010 01:11:50 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Based on my test in a simple sample using the delete snippet in you code, I could not have a NewRow object which has Unmodified state. Could you explain the steps to replicate the issue in the attached sample?&lt;/p&gt;&lt;p&gt;The sample requires Northwind database which has already provided in the WebGrid sample. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Wed, 08 Dec 2010 09:48:36 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;Do you mind providing a snippet / runnable sample for the NewRow object with "unmodified" state and for other condition when the UndoChanges fails when it is a newly added row?&lt;/p&gt;&lt;p&gt;AFAIK the row state will be updated correctly if it is a newly added row.&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Sure. I have attached the ASPX page which includes the Delete Claim function within the WebGrid's Context Menu and the underlying method that is called that is used to delete rows. In this case, the row is in an "Unmodified" state. After the Row's UndoChanges method is called, the UI just stays in the same state visually instead of disappearing as if the user clicked off the row.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreatyClaimsGrid.ascx.cs"
    Inherits="Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid" %&amp;gt;
    
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %&amp;gt;    
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebGrid"    Namespace="ISNet.WebUI.WebGrid"    TagPrefix="ISWebGrid"    %&amp;gt;
&amp;lt;%@ Register Assembly="AjaxControlToolkit"     Namespace="AjaxControlToolkit"     TagPrefix="ajaxToolKit"  %&amp;gt;

&amp;lt;script type="text/javascript" language="javascript" src='&amp;lt;%= this.Page.ResolveUrl("~" &amp;#43; Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_HASHTABLE_PATH)%&amp;gt;'&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" language="javascript" src='&amp;lt;%= this.Page.ResolveUrl("~" &amp;#43; Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_POPUPS_VALIDATEFIELDS_PATH)%&amp;gt;'&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" language="javascript" src='&amp;lt;%= this.Page.ResolveUrl("~" &amp;#43; Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_DATE_PATH)%&amp;gt;'&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script type="text/javascript"&amp;gt;
// --&amp;gt;

function &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl() 
{ 
    try { return WebGrid_GetGrid(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID()); }
    catch (ex) { ShowJSException(ex); }
} 

function &amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID()
{
    try { return "&amp;lt;%=this.grdTreatyClaims.ClientID%&amp;gt;"; }
    catch (ex) { ShowJSException(ex); }
}

function &amp;lt;%=this.ClientID%&amp;gt;_GetIncurredMovementClientID()
{
    try { return "&amp;lt;%=this.txtIncurredMovement.ClientID%&amp;gt;"; }
    catch (ex) { ShowJSException(ex); }
}

function TreatyClaimsGrid_GettxtIncurredMovementCtrl()
{
    try { return document.getElementById(&amp;lt;%=this.ClientID%&amp;gt;_GetIncurredMovementClientID()); }
    catch (ex) { ShowJSException(ex); }
}

function &amp;lt;%=this.ClientID%&amp;gt;_GetTotalIncurredMovement()
{
    try 
    { 
        var value = "";
        var field = TreatyClaimsGrid_GettxtIncurredMovementCtrl;
        if (field != null) { value = field.value; }
        return value;
    }
    catch (ex) { ShowJSException(ex); }
}

function &amp;lt;%=this.ClientID%&amp;gt;_SetViewMode(viewMode)
{
    try
    {
        // Set View Mode
        var gridID = &amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID();                
        switch(viewMode)
        {
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Outstanding%&amp;gt;":
                // Hide Claim related fields (Paid -&amp;gt; Port Out)
                WebGrid_ShowHideColumnByPos(gridID, 11, false);
                WebGrid_ShowHideColumnByPos(gridID, 12, false);
                WebGrid_ShowHideColumnByPos(gridID, 13, false);
                WebGrid_ShowHideColumnByPos(gridID, 14, false);
                WebGrid_ShowHideColumnByPos(gridID, 15, false);                
                WebGrid_ShowHideColumnByPos(gridID, 16, false);
                WebGrid_ShowHideColumnByPos(gridID, 17, false);
                break;
            default:
                // Show Claim related fields (Paid -&amp;gt; Port Out)
                WebGrid_ShowHideColumnByPos(gridID, 11, true);
                WebGrid_ShowHideColumnByPos(gridID, 12, true);
                WebGrid_ShowHideColumnByPos(gridID, 13, true);
                WebGrid_ShowHideColumnByPos(gridID, 14, true);
                WebGrid_ShowHideColumnByPos(gridID, 15, true);                
                WebGrid_ShowHideColumnByPos(gridID, 16, true);
                WebGrid_ShowHideColumnByPos(gridID, 17, true);
                break;                
        }
    }
    catch (ex) { ShowJSException(ex); }
}
        
function grdTreatyClaims_OnInitialize(gridID) 
{
    try 
    {             
        // Default view
        &amp;lt;%=this.ClientID%&amp;gt;_SetViewMode("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Default%&amp;gt;");
        
        // Hide the Accept All Changes button
        WebGrid_ShowHideAcceptAllChangesButton(gridID, false); 

        // Initialize row
        var grdTreatyClaims = ISGetObject(gridID);
        if (grdTreatyClaims != null)
        {
            for (var i = 0; i &amp;lt; grdTreatyClaims.TotalRows; i&amp;#43;&amp;#43;)
            {
                var row = grdTreatyClaims.RootTable.GetRow(i);
                InitializeRow(row);
                
                // Calculate Incurred
                CalculateIncurred(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID(), row);
            }
        }
    }
    catch (ex) { ShowJSException(ex); }
}       

function grdTreatyClaims_OnRowContextMenu(controlID, rowType, rowElement, menuObject) 
{
    try 
    {
        // Hide the Accept All Changes button
        var acceptAllChanges = menuObject.Items.GetNamedItem("mnuAcceptAllChanges");
        if (acceptAllChanges != null) { acceptAllChanges.Hide(); }
        
        // Hide default new/delete items
        var menuItemList = new Array();
        menuItemList.push("mnuAddNewRow");
        menuItemList.push("mnuDelete");
        WebGrid_ShowContextMenuItemsByList(menuObject, menuItemList, false); 
            
        // Seperator
        var separator = new WebMenuItem();
        separator.Type = "Separator";
        separator.Name = "wmiSeperator1";
        menuObject.Items.Add(separator);
       
        // Add Claim
        var newClaim = new WebMenuItem();
        newClaim.ImageURL = "../..&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.IMAGE_NEW_PATH%&amp;gt;";
        newClaim.Text = "Create CAT Claim";
        newClaim.Name = "wmiAddClaimCATClaim";
        newClaim.OnClick = "AddClaimRow";
        menuObject.Items.Add(newClaim);
                 
        // Delete Claim
        // NOTE: Only allow pending claims to be deleted
        var rowState = WebGrid_GetSelectedRowState(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID());
        if (rowState == "Added" || rowState == "Unmodified")
        {        
            var deleteClaim = new WebMenuItem();
            deleteClaim.ImageURL = "../..&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%&amp;gt;";
            deleteClaim.Text = "Delete Claim";
            deleteClaim.Name = "wmiDeleteClaim";
            deleteClaim.OnClick = "DeleteSelectedClaimRow";
            menuObject.Items.Add(deleteClaim);
        }            
    }
    catch (ex) { ShowJSException(ex); }
}
      
function grdTreatyClaims_OnCheckBoxClick(controlID, tblName, colName, checkboxValue, originalCheckBoxValue)
{
    try
    {
        // Enable/Disable Outstanding field based on respective Include CheckBox control
        // NOTE: Reset Outstanding field if disabled and ensure all calculations are performed     
        switch(colName)
        {
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;":
                EnableOutstandingField(controlID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;", checkboxValue);              
                break;            
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%&amp;gt;":
                EnableOutstandingField(controlID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;", checkboxValue);              
                break;
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%&amp;gt;":
                EnableOutstandingField(controlID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;", checkboxValue);              
                break;
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%&amp;gt;":
                EnableOutstandingField(controlID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;", checkboxValue);              
                break;
        }
    }
    catch (ex) { ShowJSException(ex); }            
}

function grdTreatyClaims_OnExitEditMode(controlID, tableName, editObject)
{
    try 
    {            
        if (editObject == null) { return; }
        
        // Format data
        // NOTE: This performs hotkey shortcuts
        formatControl(editObject.element, "Number");            
     }
     catch (ex) { ShowJSException(ex); } 
}

function grdTreatyClaims_OnAfterExitEditMode(controlID, tableName, editObject)
{
    try 
    {            
        // Get updated column's name
        if (editObject == null) { return; }
        var editObjectCell = editObject.ToCellObject();
        if (editObjectCell == null) { return; }
        var colName = editObjectCell.Name;
        var colValue = editObjectCell.Value;

        switch(colName)
        {
            // Load Catastrophe Code data
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%&amp;gt;":
                &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCode(WebGrid_GetSelectedRow(controlID));
                break;              
            // Update IncludeOutstanding field
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;", colValue);              
                break;            
            // Update IncludeOutstanding field                
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%&amp;gt;", colValue);              
                break;
            // Update IncludeOutstanding field
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%&amp;gt;", colValue);              
                break;
            // Update IncludeOutstanding field
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%&amp;gt;", colValue);              
                break;
        }                               
        // Update footer column
        UpdateGridFooterColumn(controlID, colName);
    
        // Calculate Incurred row
        CalculateIncurred(controlID, editObjectCell.Row);
        
        return true;
    }
    catch (ex) { ShowJSException(ex); } 
}

function btnCreateCATClaim_OnClientClick()
{
    try
    {
        // Add Claim Row
        AddClaimRow();
    }
    catch (ex) { ShowJSException(ex); }
}

function InitializeRow(row)
{
    var returnVal = false;
    
    try
    {
        if (row == null) { return false; }

        // Initialize Claim Row 
        &amp;lt;%=this.ClientID%&amp;gt;_InitializeClaimRowFields(row);                      
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function &amp;lt;%=this.ClientID%&amp;gt;_InitializeClaimRowFields(row)
{
    var returnVal = false;
    
    try
    {
        // Initialize the claim data
        if (row == null) { return false; }
        var rowCells = row.GetCells();
        if (rowCells == null) { return false; }
        
        // Determine if the claim is a CAT claim
        var isCatClaim = &amp;lt;%=this.ClientID%&amp;gt;_IsCATClaim(row);
       
        // Description
        var description = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%&amp;gt;");
        if (description != null) { description.SetForceNoEdit((isCatClaim == false)); }
                
        // Level 1 Cat Code
        var level1CatCode = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%&amp;gt;");
        if (level1CatCode != null) { level1CatCode.SetForceNoEdit((isCatClaim == false)); }
        
        // Level 3 Cat Code
        var level3CatCode = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%&amp;gt;");
        if (level3CatCode != null) { level3CatCode.SetForceNoEdit((isCatClaim == false)); }               
        &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCode(row, false);
        
        // Cause Of Loss
        var causeOfLoss = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%&amp;gt;");
        if (causeOfLoss != null) { causeOfLoss.SetForceNoEdit((isCatClaim == false)); }        
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); }
    
    return returnVal;
}

function AddClaimRow()
{
    try 
    {
        // 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();                 
                        
        return true;
    }
    catch (ex) { ShowJSException(ex); }       
}    
    
function &amp;lt;%=this.ClientID%&amp;gt;_DefaultClaimRow(row)
{
    try
    {
        if (row == null) { return; }
        
        // Initalize the row's fields
        &amp;lt;%=this.ClientID%&amp;gt;_InitializeClaimRowFields(row);
       
        // Determine if CAT claim 
        var isCatClaim = &amp;lt;%=this.ClientID%&amp;gt;_IsCATClaim(row);
       
        // Description
        var rowCells = row.GetCells();
        var description = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%&amp;gt;");
        if (description != null) {  WebGrid_SetFieldText(description, ""); }
        
        // Date Of Loss Qualififer
        var dateOfLossQualifier = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%&amp;gt;");
        if (dateOfLossQualifier != null) 
        { 
            WebGrid_SetDropDownListValue(dateOfLossQualifier, "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;", "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;"); 
        }                     
        
        // Claims Made Date
        var claimsMadeDate = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%&amp;gt;");
        if (claimsMadeDate != null)
        {
            var value = "";
            WebGrid_SetFieldText(claimsMadeDate, value);
        }
        
        // Reported Date
        var reportedDate = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%&amp;gt;");
        if (reportedDate != null)
        {
            var value = "";
            if (isCatClaim == false) { value = new Date(); }
            WebGrid_SetFieldText(reportedDate, value);
        }
        
        // Event Date
        var eventDate = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%&amp;gt;");
        if (eventDate != null)
        {
            var value = "";
            if (isCatClaim == false) { value = new Date(); }
            WebGrid_SetFieldText(eventDate, value);
        }
         
        // Level 1 Cat Code
        var level1CatCode = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%&amp;gt;");
        if (level1CatCode != null) 
        { 
            var text = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;";
            var value = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;";            
            WebGrid_SetDropDownListValue(level1CatCode, text, value); 
        }  
        
        // Level 3 Cat Code
        var level3CatCode = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%&amp;gt;");
        if (level3CatCode != null) 
        { 
            var text = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;";
            var value = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;";            
            WebGrid_SetDropDownListValue(level3CatCode, text, value); 
        }   
        
        // Cause Of Loss
        var causeOfLoss = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%&amp;gt;");
        if (causeOfLoss != null) 
        { 
            var text = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;";
            var value = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;";            
            WebGrid_SetDropDownListValue(causeOfLoss, text, value); 
        } 
                 
        // Misc. amount fields
        var fieldNameAndValueList = new Hashtable();
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%&amp;gt;", 0);
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;", "");
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;", "");
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;", "");
        fieldNameAndValueList.put("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;", "");
        &amp;lt;%=this.ClientID%&amp;gt;_UpdateRowClaimDataByList(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID(), fieldNameAndValueList, row);
        
        // ID
        // NOTE: This is done to avoid any validation on the DataKeyField being unique
        var id = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_UNIQUEID%&amp;gt;");
        if (id != null) 
        {
            var now = new Date();
            WebGrid_SetFieldText(id, (now.getSeconds() &amp;#43; now.getMilliseconds()));
        }
    }
    catch (ex) { ShowJSException(ex); }
}
    
function EnableOutstandingField(controlID, fieldName, enable)
{
    var returnVal = false;
    
    try
    {
        if (IsNullOrEmpty(controlID) == true || IsNullOrEmpty(fieldName) == true) { return false; }
        
        // Get selected row
        var row = WebGrid_GetSelectedRow(controlID);
        if (row == null) { return false; }
        
        // Get outstanding field
        var outstanding = row.GetCell(fieldName);
        if (outstanding == null) { return false; }
        
        // Update outstanding field data
        if (enable == false) { outstanding.SetText("", true); }
        outstanding.SetForceNoEdit((enable == false));
        TreatyClaimsGrid_UpdateField(controlID, row, outstanding, null, false);
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function TreatyClaimsGrid_SetEnabled(gridID, isEnabled) 
{         
    try 
    { 
        // Enable/Disable TreatyClaims grid
        // NOTE: A div is used to prevent user input due to Intersoft WebGrid bug allowing input of a disabled grid.
        WebGrid_Enabled(gridID, isEnabled); 
        $("#divTreatyClaims").css("zIndex", (isEnabled == true) ? 0 : 1);
        
        // Enable/Disabe Create Claim button
        var btnCreateCATClaim = ISGetObject("&amp;lt;%=this.btnCreateCATClaim.ClientID%&amp;gt;");
        if (btnCreateCATClaim != null)
        {
            if (isEnabled == true) { btnCreateCATClaim.Enable(); } else { btnCreateCATClaim.Disable(); }
        }
    }
    catch (ex) { ShowJSException(ex); }
}  

function UpdateGridFooterColumn(controlID, colName)
{
    try
    {
        if (IsNullOrEmpty(controlID) == true) { return; }
        if (IsNullOrEmpty(colName) == true) { return; }
        
        // Get footer column's new value
        // NOTE: Check for Include field
        switch(colName)
        {
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;":
                colName = "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;"; 
                break;
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%&amp;gt;":
                colName = "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;"; 
                break;
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%&amp;gt;":
                colName = "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;"; 
                break;
            case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%&amp;gt;":
                colName = "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;"; 
                break;                                                
        }
        var colFooterNewValue = WebGrid_GetColumnAggregateValue(controlID, colName, null);
        
        // Update footer column
        if (IsNullOrEmpty(colFooterNewValue) == false)
        {
            WebGrid_SetFooterColumnValue(controlID, colName, TreatyClaimsGrid_FormatAmount(colFooterNewValue));
        }                
    }
    catch (ex) { ShowJSException(ex); } 
}

function CalculateIncurred(gridID, row)
{
    var returnVal = false;
    
    try
    {
        return true;
        // TODO: This method needs to be reviewed as various fields don't appear to exist on a "pending" row (NewRow)
        if (row == null) { return false; }
        var rowCells = row.GetCells();
        if (rowCells == null) { return; }
        var paid = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%&amp;gt;").Value);
        var expenses = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%&amp;gt;").Value);
        var salvage = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%&amp;gt;").Value);
        var indOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;").Value);
        var currentINDOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INDOUTSTANDING%&amp;gt;").Value);
        var currentIND = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_IND%&amp;gt;").Value);
        var currentFEE = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_FEE%&amp;gt;").Value);
        var currentREC = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_REC%&amp;gt;").Value);
        var cashLoss = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%&amp;gt;").Value);
        var refund = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%&amp;gt;").Value);
        var claimPortfolioIn = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%&amp;gt;").Value);
        var claimPortfolioOut = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%&amp;gt;").Value);
        var currentIncurred = StripCommasFromNumeric(rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%&amp;gt;").Value);
        var incurred = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED%&amp;gt;");
        var incurredMovement = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%&amp;gt;");
        var includeOS = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;");                                        
        
        // Check includeOS Checkbox to determine if the O/S value should be used in incurred movement calculation
        if (includeOS != null &amp;amp;&amp;amp; includeOS.Value == false) 
        { 
            indOutstanding = currentINDOutstanding; 
        }
       
        // Enable Incurred and Movement to update value
        if (includeOS != null) { incurred.SetForceNoEdit(false); }
        if (incurredMovement != null) { incurredMovement.SetForceNoEdit(false); }
       
        var newIncurred = currentIND &amp;#43; currentFEE - currentREC &amp;#43; paid &amp;#43; expenses - salvage &amp;#43; indOutstanding &amp;#43; cashLoss - refund - claimPortfolioIn &amp;#43; claimPortfolioOut;
        var incurredMovementValue = newIncurred - currentIncurred;
        var txtIncurredMovement = TreatyClaimsGrid_GettxtIncurredMovementCtrl();
      
        if (incurred != null) { incurred.SetText(TreatyClaimsGrid_FormatAmount(newIncurred), true); }
        if (incurredMovement != null) { incurredMovement.SetText(TreatyClaimsGrid_FormatAmount(incurredMovementValue), true); }
        
        // Update footer column
        var currentIncurred = WebGrid_GetColumnAggregateValue(gridID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%&amp;gt;", null);
        WebGrid_SetFooterColumnValue(gridID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%&amp;gt;", TreatyClaimsGrid_FormatAmount(currentIncurred));

        // Update footer column
        var totalIncurredMovement = Math.abs(WebGrid_GetColumnAggregateValue(gridID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%&amp;gt;", null));
        WebGrid_SetFooterColumnValue(gridID, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%&amp;gt;", TreatyClaimsGrid_FormatAmount(totalIncurredMovement));
        if (txtIncurredMovement != null) { txtIncurredMovement.value = totalIncurredMovement; }
        
        // Disable Incurred and Movement field after updating value
        if (incurred != null) { incurred.SetForceNoEdit(true); }
        if (incurredMovement != null) { incurredMovement.SetForceNoEdit(true); }
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function TreatyClaimsGrid_UpdateClaimData(gridID, fieldName, value, forceUpdate) 
{
    try 
    {
        // Field Name must be specified
        if (IsNullOrEmpty(fieldName) == true) { return false; }
        
         // Determine if update is allowed
        var allowUpdate = TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate);
        if (allowUpdate == false) { return false; }
       
        // Get 1st claim
        var row = &amp;lt;%=this.ClientID%&amp;gt;_GetFirstRow();
        if (row == null) { return false; }
                 
        // Update field
        TreatyClaimsGrid_UpdateField(gridID, row, WebGrid_GetField(row, fieldName), value);
    }
    catch (ex) { ShowJSException(ex); }
}

function &amp;lt;%=this.ClientID%&amp;gt;_UpdateClaimDataByList(gridID, fieldNameAndValueList, forceUpdate) 
{
    var returnVal = false;

    try 
    {
        // Field Name/Value List must be specified
        if (fieldNameAndValueList == null || fieldNameAndValueList.isEmpty() == true) { return false; }
            
        // Determine if update is allowed
        var allowUpdate = TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate);
        if (allowUpdate == false) { return false; }
       
        // Get 1st claim
        var row = &amp;lt;%=this.ClientID%&amp;gt;_GetFirstRow();
        if (row == null) { return false; }
        
        // Update claim data
        &amp;lt;%=this.ClientID%&amp;gt;_UpdateRowClaimDataByList(gridID, fieldNameAndValueList, row);        
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }

    return returnVal;
}

function &amp;lt;%=this.ClientID%&amp;gt;_UpdateRowClaimDataByList(gridID, fieldNameAndValueList, row)
{
    var returnVal = false;
    
    try
    {
        if (row == null) { return false; }
        
        var rowCells = row.GetCells();                 
        if (rowCells == null) { return false; }
        for (var fieldName in fieldNameAndValueList.getList()) 
        {
            // Get/Update claim's specified field
            var fieldToUpdate = rowCells.GetNamedItem(fieldName);
            if (fieldToUpdate != null) 
            {
                var fieldValue = fieldNameAndValueList.get(fieldName);
                TreatyClaimsGrid_UpdateField(gridID, row, fieldToUpdate, fieldValue, true, false);
                returnVal = true;
            }
        }

        // Calculate Incurred data
        // NOTE: This should only be done after all the row updates for performance
        CalculateIncurred(gridID, row);
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }

    return returnVal;
}

function TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate) 
{
    try 
    {
        // Update only if 1 claim exists
        // NOTE: Do not force update if not specified       
        if (typeof (forceUpdate) == "undefined") { forceUpdate = false; } 
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl();
        if (grid == null) { return false; }
        var rowCount = WebGrid_GetTotalRowCount(gridID);
        if (rowCount &amp;gt; 1 &amp;amp;&amp;amp; forceUpdate == false) { return false; }
    }
    catch (ex) { ShowJSException(ex); }
    
    return true;
}

function TreatyClaimsGrid_UpdateField(gridID, row, field, value, updateField, calculateIncurred) 
{ 
    try
    {
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl();
        if (grid == null) { return false; } 
        if (field == null) { return false; }
        if (typeof (updateField) == "undefined") { updateField = true; }
        if (typeof (calculateIncurred) == "undefined") { calculateIncurred = true; } 
                     
        // Update field data            
        // NOTE: Force field update if not specified
        if (updateField == true)
        {
            var forceNoEdit = field.ForceNoEdit;
            if (field.ForceNoEdit == true) { field.SetForceNoEdit(false); }
            switch(field.Name)
            {
                // INDOutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;", value);
                    }
                    break;
                // FEEOutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%&amp;gt;", value);
                    }
                    break;                     
                // ACROutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%&amp;gt;", value);
                    }
                    break;    
                // ACEOutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;", "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%&amp;gt;", value);
                    }
                    break;                                     
            }                             
            field.SetText(TreatyClaimsGrid_FormatAmount(value), true);
            
            // Update row to force row changes
            if (row != null) { row.Update();}
        }
        
        // Update footer data
        UpdateGridFooterColumn(grid.Id, field.Name);
                      
        // Update Incurred data
        if (row != null &amp;amp;&amp;amp; calculateIncurred == true) { CalculateIncurred(gridID, row); }                    
        
        field.ForceNoEdit = forceNoEdit;
    }
    catch (ex) { ShowJSException(ex); }
}     
  
function TreatyClaimsGrid_UpdateIncludeOutstandingField(row, outstandingFieldName, includeOutstandingFieldName, value)
{
    try
    {
        if (row == null) { return; }
        var rowCells = row.GetCells();
        if (rowCells == null) { return; }
        
        // Update Outstanding
        var outstandingField = rowCells.GetNamedItem(outstandingFieldName);
        if (outstandingField != null) 
        { 
            outstandingField.SetForceNoEdit((IsNullOrEmpty(value) == true));
        }
        
        // Update Include Outstanding
        var includeOutstandingField = rowCells.GetNamedItem(includeOutstandingFieldName);
        if (includeOutstandingField != null) 
        {
            WebGrid_SetCheckboxValue(includeOutstandingField, (IsNullOrEmpty(value) == false));
        }            
    }
    catch (ex) { ShowJSException(ex); }            
}   
    
function DeleteSelectedClaimRow(gridID)
{
    try 
    { 
        // Delete
        WebGrid_DeleteSelectedRow(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID());
    }
    catch (ex) { ShowJSException(ex); }
}   
     
/* Validate [START] */

function grdTreatyClaims_OnRowValidate(gridID, tableName, editObject)
{
    try 
    { 
        // Validate Row   
        return ValidateTreatyClaimsRow(WebGrid_GetSelectedRow(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID()), true);
    }
    catch (ex) { ShowJSException(ex); }
}

function &amp;lt;%=this.ClientID%&amp;gt;_Validate(displayMsg) 
{ 
    var returnVal = false;
    
    try
    {
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl();
        if (grid == null) { return true; }
        
        // Get grid's RowChanges
        var rowChanges = grid.GetChanges();
        if (rowChanges == null) { return true; }
        
        // Validate each row
        if (typeof (displayMsg) == "undefined") { displayMsg = true; }
        for(var index in rowChanges)
        {
            var validate = ValidateTreatyClaimsRow(rowChanges[index].Row, displayMsg);
            if (validate == false) { return false; }
        } 
        
        return true;
    }
    catch (ex) { ShowJSException(ex); }                       
}

var _fieldToFocus = null;
function ValidateTreatyClaimsRow(row, displayMsg)
{
    try
    {
        // Do not validate FilterRow or Deleted rows
        if (row == null) { return true; }                         
        if (WebGrid_IsCurrentRowFilterRow(&amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID()) == true) { return true; }
        if (row.GetRowState() == "Deleted") { return true; }
        
        // Determine if CAT claim
        var isCATClaim = &amp;lt;%=this.ClientID%&amp;gt;_IsCATClaim(row);
                
        // Get row's cells
        var rowCells = row.GetCells();
        if (rowCells == null) { return true; }
                        
        // Description
        var msg = new Array();
        var fieldFocus = null;
        var descriptionText = "";
        var dateOfLossQualifierValue = "";
        if (isCATClaim == true)
        {
            // Required
            var description = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%&amp;gt;");
            var descriptionText = (description != null) ? description.Text : null;
            if (IsNullOrEmpty(descriptionText) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DESCRIPTION_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = description; }
            }
        }
            
        // Date Of Loss Qualifier
        if (isCATClaim == true)
        {            
            // Required
            var dateOfLossQualifier = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%&amp;gt;");            
            dateOfLossQualifierValue = (dateOfLossQualifier != null) ? dateOfLossQualifier.Value : null;
            if (IsNullOrEmpty(dateOfLossQualifierValue) == true || dateOfLossQualifierValue == "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;") 
            {
                msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DATEOFLOSSQUALIFIER_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = dateOfLossQualifier; }
            }                                               
        }    

        // Claims Made Date
        if (isCATClaim == true)
        {
            // Required
            var claimsMadeDate = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%&amp;gt;"); 
            var claimsMadeDateObj = (claimsMadeDate != null) ? parseDate(claimsMadeDate.Text) : null;       
            if (IsNullOrEmpty(claimsMadeDateObj) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
            }                                    
            else
            {
                // Cannot be greater than today
                if (claimsMadeDateObj &amp;gt; new Date()) 
                {
                    msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_GREATERTHANTODAY%&amp;gt;");
                    if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
                }
            
                // Cannot be before policy's effective date                      
                var dateInception = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCEPTIONDATE%&amp;gt;"); 
                var dateInceptionObj = (dateInception != null) ? parseDate(dateInception.Text) : null;
                if (claimsMadeDateObj &amp;lt; dateInceptionObj) 
                {
                    msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_BEFOREPOLICYEFFECTIVEDATE%&amp;gt;" &amp;#43; " (" &amp;#43; dateInception.Text &amp;#43; ")");
                    if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
                }
            }
        }  
                
        // Reported Date
        if (isCATClaim == true)
        {
            // Required
            var dateReported = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%&amp;gt;");
            var dateReportedObj = (dateReported != null) ? parseDate(dateReported.Text) : null;
            if (IsNullOrEmpty(dateReportedObj) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
            } 
            else
            {
                // Cannot be greater than today
                if (dateReportedObj &amp;gt; new Date()) 
                {
                    msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_GREATERTHANTODAY%&amp;gt;");
                    if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
                }
            
                // Cannot be before claim's made/DOL date
                var dateClaimsMade = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%&amp;gt;"); 
                var dateClaimsMadeObj = (dateClaimsMade != null) ? parseDate(dateClaimsMade.Text) : null;
                if (dateReportedObj &amp;lt; dateClaimsMadeObj) 
                {
                    msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_BEFORECLAIMSMADEDATE%&amp;gt;" &amp;#43; " (" &amp;#43; dateClaimsMade.Text &amp;#43; ")");
                    if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
                }
            }                                                          
        }

        // Event Date
        if (isCATClaim == true &amp;amp;&amp;amp; dateOfLossQualifierValue == "&amp;lt;%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_DATEOFLOSSQUALIFIER_CLAIMSMADE_VALUE%&amp;gt;")
        {
            // Required
            var dateEvent = rowCells.GetNamedItem("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%&amp;gt;");
            var dateEventObj =  (dateEvent != null) ? parseDate(dateEvent.Text) : null;
            if (IsNullOrEmpty(dateEventObj) == true) 
            {
                msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_REQUIRED%&amp;gt;");
                if (_fieldToFocus == null) { _fieldToFocus = dateEvent; }
            }  
            else
            {
                // Cannot be greater than today
                if (dateEventObj &amp;gt; new Date()) 
                {
                    msg.push("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_INVALID_GREATERTHANTODAY%&amp;gt;");
                    if (_fieldToFocus == null) { _fieldToFocus = dateEvent; }
                }                                                        
            }                
        }        
        
        // Display validation message
        // NOTE: Add Description to caption if specified
        if (msg != null &amp;amp;&amp;amp; msg.length &amp;gt; 0)
        {
            // Display
            // NOTE: Select row after display       
            if (displayMsg == true)
            {
                var caption = "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_VALIDATION_FAILED%&amp;gt;";
                if (IsNullOrEmpty(descriptionText) == false) { caption &amp;#43;= " - Description: " &amp;#43; descriptionText; }
                WebDialogBox_ShowDialog(caption, Array_GetList(msg, "&amp;lt;%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%&amp;gt;"), "OK", &amp;lt;%=this.ClientID%&amp;gt;_FocusRow); 
            }                    
            return false;
        }
        return true;
    }
    catch (ex) { ShowJSException(ex); }             
}

function &amp;lt;%=this.ClientID%&amp;gt;_IsAmountExist() 
{ 
    try
    {
        // Check if an amount is specified       
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl();
        if (grid == null) { return false; }
         
        // Get grid's RowChanges
        debugger;
        var rowChanges = grid.GetChanges();
        if (rowChanges == null || rowChanges.length == 0) { return true; }
        
        // Validate each row
        for(var index in rowChanges)
        {       
            var row = rowChanges[index].Row;
            if (row != null)
            {
                var rowCells = row.GetCells();
                if (rowCells != null)
                {
                    // Paid
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%&amp;gt;") == true) { return true; }
                    
                    // Expenses
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%&amp;gt;") == true) { return true; }

                    // Salvage
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%&amp;gt;") == true) { return true; }

                    // Cash Loss
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%&amp;gt;") == true) { return true; }
        
                    // Refund
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%&amp;gt;") == true) { return true; }
        
                    // Claim Portfolio In
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%&amp;gt;") == true) { return true; }
                    
                    // Claim Portfolio Out
                    if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%&amp;gt;") == true) { return true; }
                    
                    // IND Outstanding
                    if (WebGrid_GetCheckboxValue("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%&amp;gt;", rowCells) == true)
                    {
                        if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%&amp;gt;") == true) { return true; }
                    }
                    
                    // FEE Outstanding
                    if (WebGrid_GetCheckboxValue("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%&amp;gt;", rowCells) == true)
                    {
                        if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%&amp;gt;") == true) { return true; }                       
                    }
                    
                    // ACR Outstanding
                    if (WebGrid_GetCheckboxValue("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%&amp;gt;", rowCells) == true)
                    {
                        if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%&amp;gt;") == true) { return true; }                       
                    }
                    
                    // ACE Outstanding
                    if (WebGrid_GetCheckboxValue("&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%&amp;gt;", rowCells) == true)
                    {
                        if (&amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%&amp;gt;") == true) { return true; }                     
                    }                    
                }
            }
        }       
    }
    catch (ex) { ShowJSException(ex); returnVal = false;}                       
    
    return false;
}

function &amp;lt;%=this.ClientID%&amp;gt;_IsAmountValueExist(rowCells, fieldName) 
{ 
    var returnVal = false;
    
    try
    {
        // Check if the Amount value exist
        if (rowCells == null || IsNullOrEmpty(fieldName) == true) { return false; }       
        var field = rowCells.GetNamedItem(fieldName);
        if (field == null) { return false; }
        returnVal = (StripCommasFromNumeric(field.Value) &amp;gt; 0);       
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }                       
    
    return returnVal;
}

function &amp;lt;%=this.ClientID%&amp;gt;_IsOutstandingChecked(rowCells, fieldName) 
{ 
    var returnVal = false;
    
    try
    {
        // Check if the Amount value exist
        if (rowCells == null || IsNullOrEmpty(fieldName) == true) { return false; }       
        var field = rowCells.GetNamedItem(fieldName);
        if (field == null) { return false; }
        returnVal = (StripCommasFromNumeric(field.Value) &amp;gt; 0);       
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }                       
    
    return returnVal;
}

function &amp;lt;%=this.ClientID%&amp;gt;_FocusRow()
{
    var returnVal = false;
    
    try
    {
        // 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.ClientID%&amp;gt;_GetGridClientID(), _fieldToFocus.Row, _fieldToFocus.Name);                 
        _fieldToFocus = null;  
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }     
    
    return returnVal;
}
        
/* Validate [END] */
   
function &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCode(row, defaultList)
{
    var returnVal = false;
    
    try
    {
        // Load Catastrophe Code data for CAT Claims only
        if (row == null) { return false; }
        if (&amp;lt;%=this.ClientID%&amp;gt;_IsCATClaim(row) == false) { return false; }        
        
        // Get DOL
        var claimsMadeDateObj = parseDate(WebGrid_GetFieldValue(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%&amp;gt;"));        
        
        // Load Claim's Level 1 and Level 3 Catastrophe Code data  
        if (typeof(defaultList) == "undefined") { defaultList = true; }                   
        &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCodeControl(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%&amp;gt;", claimsMadeDateObj, _GeniusClaimLevel1CatCode, defaultList);
        &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCodeControl(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%&amp;gt;", claimsMadeDateObj, _GeniusClaimLevel3CatCode, defaultList);
               
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function &amp;lt;%=this.ClientID%&amp;gt;_LoadClaimCatCodeControl(row, catCodeFieldName, dateOfLoss, geniusClaimCatCode, defaultList)
{
    var returnVal = false;
    
    try
    {                               
        // Load the Cat Code data
        // NOTE: Clear items but Select 
        if (IsNullOrEmpty(catCodeFieldName) == true) { return false; }
        if (typeof(geniusClaimCatCode) == "undefined" || geniusClaimCatCode == null || geniusClaimCatCode.length == 0) { return false; }        
        var $dropdownList = $("#" &amp;#43; &amp;lt;%=this.ClientID%&amp;gt;_GetGridClientID() &amp;#43; "__" &amp;#43; catCodeFieldName);
        if ($dropdownList == null) { return false; }         
        $("option:not(:first)", $dropdownList).remove();
        var dropdownListDOM = $dropdownList.get(0);
        if (dropdownListDOM == null) { return false; }
        $.each(geniusClaimCatCode, function(val, item) 
        {
            if (JSON_ToDate(item.CatastropheDateOfLossFrom) &amp;lt;= dateOfLoss &amp;amp;&amp;amp;
                JSON_ToDate(item.CatastropheDateOfLossTo) &amp;gt;= dateOfLoss) 
            {
                dropdownListDOM.options.add(new Option(item.CatastropheShortName, item.CatastropheCode));   
            }
        });
        
        // Default Select
        if (defaultList == true)
        {
            if (row == null) { return false; }
            var rowCells = row.GetCells();
            if (rowCells == null) { return false; }
            var catCodeField = rowCells.GetNamedItem(catCodeFieldName);
            if (catCodeField != null) 
            { 
                var text = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%&amp;gt;";
                var value = "&amp;lt;%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%&amp;gt;";   
                WebGrid_SetDropDownListValue(catCodeField, text, value);  
            }
        }
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}
    
function &amp;lt;%=this.ClientID%&amp;gt;_IsCATClaim(row)
{
    var returnVal = false;
    
    try
    {
        // Determine if the claim is a Catastrophe claim
        if (row == null) { return false; }
        var level1CatValue = WebGrid_GetFieldValue(row, "&amp;lt;%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%&amp;gt;");
        returnVal = (level1CatValue != "&amp;lt;%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_TYPE_BLOCK_VALUE%&amp;gt;");
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}
    
function &amp;lt;%=this.ClientID%&amp;gt;_GetFirstRow()
{
    var row = null;
    
    try
    {
        // Get 1st claim
        var grid = &amp;lt;%=this.ClientID%&amp;gt;_GetGridCtrl();
        if (grid == null) { return null; }
        var row = grid.RootTable.GetRow(0);
    }
    catch (ex) { ShowJSException(ex); }
    
    return row;        
}     


// Function to add formatting (eg "," etc) to supplied number value
function TreatyClaimsGrid_FormatAmount(number) 
{
    try 
    {
        var num = new NumberFormat();
        num.setInputDecimal(".");
        num.setPlaces("2");
        num.setNegativeFormat(num.LEFT_DASH);
        num.setCommas(true);
        
        var result = number;
        num.setNumber(result);
        result = num.toFormatted();
        return result;
    } 
    catch (ex) { ShowJSException(ex); }
}

// --&amp;gt;
&amp;lt;/script&amp;gt;   

&amp;lt;table style="table-layout:fixed;width:100%;height:100%"&amp;gt;
&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;
        &amp;lt;ISWebDesktop:WebButton runat="server" ID="btnCreateCATClaim" DisplayMode="TextAndImage" Text="Create CAT Claim" Image="~/Images/16x16/wg5_newrow.gif" ToolTip="Create a Catastrophe claim" 
                                ImagePosition="Left" Height="20px" Width="125px" 
                                AutoPostback="false" OnClientClick="javascript:btnCreateCATClaim_OnClientClick()" /&amp;gt;
    &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;
        &amp;lt;div class="ContentTemplateGridContent"&amp;gt;
            &amp;lt;div id="divTreatyClaims" style="width:100%;height:100%;position:absolute;margin:0px;
                 padding: 0px; background-color: #dcdcdc; filter: alpha(opacity=50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.5"&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;asp:TextBox runat="server" ID="txtIncurredMovement" CssClass="HideControl" /&amp;gt;
            &amp;lt;CommonCtrl:EnduranceWebGrid runat="server" ID="grdTreatyClaims" DefaultStyleMode="Elegant"
                Height="100%" Width="100%" UseDefaultStyle="True" EnableViewState="false" ViewStateStorage="None"
                OnInitializeDataSource="grdTreatyClaims_OnInitializeDataSource" OnInitializeLayout="grdTreatyClaims_OnInitializeLayout"
                OnInitializePostBack="grdTreatyClaims_OnInitializePostBack" OnPrepareDataBinding="grdTreatyClaims_OnPrepareDataBinding"
                OnExport="grdTreatyClaims_OnExport" OnBatchUpdate="grdTreatyClaims_OnBatchUpdate"
                OnInitializeRow="grdTreatyClaims_OnInitializeRow"&amp;gt;
                &amp;lt;LayoutSettings AllowBatchUpdate="true" BatchUpdateSettings-PromptUnsavedChanges="false" NewRowLostFocusAction="AlwaysUpdate"
                    AllowAddNew="Yes" AllowEdit="Yes" AllowDelete="Yes" EditOnClick="True" AutoHeight="false" RowHeightDefault="22px"
                    AutoWidth="false" AllowColumnFreezing="Yes" AllowExport="No" AllowFilter="No"
                    AllowSelectColumns="Yes" AllowSorting="No" AlwaysShowHelpButton="False" ApplyFiltersKey="Enter"
                    CellPaddingDefault="0" FilterBarVisible="True" HideColumnsWhenGrouped="Default"
                    InProgressUIBehavior="ChangeCursorToHourGlass"
                    PagingExportMode="ExportAllData" PagingMode="VirtualLoad" ResetNewRowValuesOnError="False"
                    ShowFilterStatus="True" VerboseEditingInformation="False" VirtualPageSize="200"&amp;gt;
                    &amp;lt;ClientSideEvents OnInitialize="grdTreatyClaims_OnInitialize" OnRowContextMenu="grdTreatyClaims_OnRowContextMenu"
                        OnCheckBoxClick="grdTreatyClaims_OnCheckBoxClick" 
                        OnExitEditMode="grdTreatyClaims_OnExitEditMode"
                        OnAfterExitEditMode="grdTreatyClaims_OnAfterExitEditMode" 
                        OnRowValidate="grdTreatyClaims_OnRowValidate" /&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" Style="solid" Width="1" /&amp;gt;
                            &amp;lt;Right Color="#6593cf" Style="solid" Width="1" /&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;Over CssClass="WebGridStatusBarCommandStyleOver" /&amp;gt;
                        &amp;lt;Active CssClass="WebGridStatusBarCommandStyleActive" /&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 AbsoluteScrolling="True" ActiveFrozenColumns="3" MaxFrozenColumns="3"
                        ShowInContextMenu="False" ShowSplitterLine="False" SplitterLineColor="ActiveBorder"
                        SplitterLineWidth="1" /&amp;gt;
                &amp;lt;/LayoutSettings&amp;gt;
                &amp;lt;RootTable Caption="Claims Transaction" DataKeyField="UniqueID" ColumnFooters="Yes"&amp;gt;                
                    &amp;lt;Columns&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="UniqueID" Name="UniqueID" 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="InceptionDate" Name="InceptionDate" DataMember="InceptionDate" 
                                                 DataFormatString="dd-MMM-yyyy" 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="Claim Number" Name="ClaimMasterReference" DataMember="ClaimMasterReference"
                            DataType="System.String" EditType="NoEdit" FilterEditType="TextBox" Width="150px"
                            FooterText="Total"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                                
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Description" Name="ClaimTitle" DataMember="ClaimTitle"
                            DataType="System.String" EditType="TextBox" FilterEditType="TextBox" Width="275px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                                
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Date of Loss Qualifier" Name="DateOfLossQualifier" DataMember="DateOfLossQualifier"
                            DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="125px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt; 
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Claims Made Date/Date of Loss" Name="ClaimDateOfLossFrom" DataMember="ClaimDateOfLossFrom"
                            DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo"
                            NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="175px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                                                                                                                
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Reported Date" Name="ClaimAdvisedDate" DataMember="ClaimAdvisedDate"
                            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="Event Date" Name="DateOfEvent" DataMember="DateOfEvent"
                            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="Level 1 Cat" Name="ClaimLevel1CATCode" DataMember="ClaimLevel1CATCode"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="100px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Level 3 Cat" Name="ClaimLevel3CATCode" DataMember="ClaimLevel3CATCode"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="100px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                            
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Cause of Loss" Name="LossAnalysis1Code" DataMember="LossAnalysis1Code"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="120px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        
                        
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Paid" Name="Paid" DataMember="Paid" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Expenses" Name="Expenses" DataMember="Expenses" DataFormatString="#,##0.00" 
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="80px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Salvage" Name="Salvage" DataMember="Salvage" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Cash Loss" Name="CashLoss" DataMember="CashLoss" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="80px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Refund" Name="Refund" DataMember="Refund" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Port In" Name="ClaimPortfolioIn" DataMember="ClaimPortfolioIn"
                            DataFormatString="#,##0.00" DefaultValue="0" DataType="System.Decimal" EditType="TextBox" FilterEditType="TextBox"
                            Width="80px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Port Out" Name="ClaimPortfolioOut" DataMember="ClaimPortfolioOut"
                            DataFormatString="#,##0.00" DefaultValue="0" DataType="System.Decimal" EditType="TextBox" FilterEditType="TextBox"
                            Width="80px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        
                        
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current Indemnity O/S" Name="CurrentINDOutstanding" DataMember="CurrentINDOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="NoEdit" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption=" " Name="IncludeINDOutstanding" DataMember="IncludeINDOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                          
                        &amp;lt;ISWebGrid:WebGridColumn Caption="New Indemnity O/S" Name="INDOutstanding" DataMember="INDOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current Fee O/S" Name="CurrentFEEOutstanding" DataMember="CurrentFEEOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="NoEdit" FilterEditType="NoEdit"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption=" " Name="IncludeFEEOutstanding" DataMember="IncludeFEEOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                          
                        &amp;lt;ISWebGrid:WebGridColumn Caption="New Fee O/S" Name="FEEOutstanding" DataMember="FEEOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                                                                                
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current ACR O/S" Name="CurrentACROutstanding" DataMember="CurrentACROutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;                              
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption=" " Name="IncludeACROutstanding" DataMember="IncludeACROutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                          
                        &amp;lt;ISWebGrid:WebGridColumn Caption="New ACR O/S" Name="ACROutstanding" DataMember="ACROutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        
                        &amp;lt;ISWebGrid:WebGridColumn Caption="ACE O/S" Name="CurrentACEOutstanding" DataMember="CurrentACEOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;                              
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption=" " Name="IncludeACEOutstanding" DataMember="IncludeACEOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                          
                        &amp;lt;ISWebGrid:WebGridColumn Caption="New ACE O/S" Name="ACEOutstanding" DataMember="ACEOutstanding"
                            DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="130px" AggregateFunction="Sum"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;                       
  
  
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current IND" Name="CurrentIND" DataMember="CurrentIND" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current FEE" Name="CurrentFEE" DataMember="CurrentFEE" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false"&amp;gt;                            
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current REC" Name="CurrentREC" DataMember="CurrentREC" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Current Incurred" Name="CurrentIncurred" DataMember="CurrentIncurred" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Incurred" Name="Incurred" DataMember="" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit" 
                            AggregateFunction="Sum" Visible="false"&amp;gt;
                        &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
                        &amp;lt;ISWebGrid:WebGridColumn Caption="Movement" Name="IncurredMovement" DataMember="" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false"&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;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;

function WebGrid_DeleteSelectedRow(gridID) 
{
    try 
    {
        // Delete selected row
        // NOTE: Use UndoChanges for rows that were added and now deleted as RowState won't change to Deleted if the Delete method is used
        //       Hide the deleted row for Intersoft's BatchUpdate 
        var row = WebGrid_GetSelectedRow(gridID);
        if (row == null) { return; }
        var rowState = row.GetRowState();

        if (rowState.toUpperCase() == "ADDED") 
        {
            row.UndoChanges();
            WebGrid_HideRow(row);
        }
        else if (rowState.toUpperCase() == "UNMODIFIED") 
        {
            window.alert("UNMODIFIED");
            row.UndoChanges();
        }
        else 
        {
            row.Delete();
            WebGrid_HideRow(row);
        }              
    }
    catch (ex) { ShowJSException(ex); }
}
&lt;/pre&gt;
</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Tue, 07 Dec 2010 22:30:04 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Do you mind providing a snippet / runnable sample for the NewRow object with "unmodified" state and for other condition when the UndoChanges fails when it is a newly added row?&lt;/p&gt;&lt;p&gt;AFAIK the row state will be updated correctly if it is a newly added row.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Tue, 07 Dec 2010 18:06:39 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;If you wish to remove newly added row during batchupdate, you will need to invoke &lt;em&gt;UndoChanges&lt;/em&gt; method. The &lt;em&gt;Delete&lt;/em&gt; method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using &lt;em&gt;GetRowState&lt;/em&gt; function. Here is the snippet:&lt;/p&gt;&lt;pre&gt;function DeleteRow() {&lt;br /&gt;    var grid = ISGetObject("WebGrid1");&lt;br /&gt;    var selObj = grid.GetSelectedObject();&lt;br /&gt;    var rowObj = selObj.ToRowObject()&lt;br /&gt;&lt;br /&gt;    if (rowObj.GetRowState() == "Added")&lt;br /&gt;        rowObj.UndoChanges();&lt;br /&gt;    else&lt;br /&gt;        rowObj.Delete();&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;How would this work for the NewRow object in an "Unmodified" state? The Delete or UndoChanges doesn't make a difference. If a row exists, the user can click to that row basically cancelling the NewRow but&amp;nbsp;I need to automate this. Also, that won't work if another row does not exist.&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Mon, 27 Sep 2010 22:22:50 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;I have created a feature request so the delete function will automatically called the UndoChanges method depending the state of the row. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The documentation already mention how to cancel changes in pending row during batch update in the article titled, &lt;span id="pagetitle"&gt;&lt;em&gt;How-to: Undo changes on specific row&lt;/em&gt;. This is also valid for the added pending row.&amp;nbsp; &lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Wed, 22 Sep 2010 09:58:14 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;If you wish to remove newly added row during batchupdate, you will need to invoke &lt;em&gt;UndoChanges&lt;/em&gt; method. The &lt;em&gt;Delete&lt;/em&gt; method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using &lt;em&gt;GetRowState&lt;/em&gt; function. Here is the snippet:&lt;/p&gt;&lt;pre&gt;function DeleteRow() {&lt;br /&gt;    var grid = ISGetObject("WebGrid1");&lt;br /&gt;    var selObj = grid.GetSelectedObject();&lt;br /&gt;    var rowObj = selObj.ToRowObject()&lt;br /&gt;&lt;br /&gt;    if (rowObj.GetRowState() == "Added")&lt;br /&gt;        rowObj.UndoChanges();&lt;br /&gt;    else&lt;br /&gt;        rowObj.Delete();&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This works for me but I had to remove the Row's AddPendingChanges() method which in another post was said to be called. &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Also, is there a reason why the Row's Delete method doesn't call the Row's UndoChanges() method behind the scene if the RowState is "Added"? It would save the developer from having to know this and it's not mentioned in the documentation.&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Tue, 21 Sep 2010 23:05:12 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;If you wish to remove newly added row during batchupdate, you will need to invoke &lt;em&gt;UndoChanges&lt;/em&gt; method. The &lt;em&gt;Delete&lt;/em&gt; method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using &lt;em&gt;GetRowState&lt;/em&gt; function. Here is the snippet:&lt;/p&gt;&lt;pre&gt;function DeleteRow() {&lt;br /&gt;    var grid = ISGetObject("WebGrid1");&lt;br /&gt;    var selObj = grid.GetSelectedObject();&lt;br /&gt;    var rowObj = selObj.ToRowObject()&lt;br /&gt;&lt;br /&gt;    if (rowObj.GetRowState() == "Added")&lt;br /&gt;        rowObj.UndoChanges();&lt;br /&gt;    else&lt;br /&gt;        rowObj.Delete();&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Mon, 20 Sep 2010 13:01:25 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;Hello Shawn,&lt;/p&gt;&lt;p&gt;As you have said before that you would get me a sample for this issue.&lt;br /&gt;I think it would be better for me to see the sample first.&amp;nbsp;&lt;br /&gt;I need to replicate your issue to investigate your issue.&lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I updated an existing page in the WebGrid tutorial to show the two issues I have:&lt;/p&gt;
&lt;p&gt;1)  Click on the "Add 5 new rows and delete 2"  button and it will show 5 rows in an Added RowState even though the first two should be deleted. The UI doesn't indicate that any rows are deleted. Highlight an existing row and click "Delete Selected Row". That will change the UI and indicate the RowState as Deleted. This is the same code that deletes rows in the "Add 5 new rows and delete 2" button.&lt;/p&gt;
&lt;p&gt;2) Click on the "Add 5 new rows and delete 2"  button and then click the "Check WebRowChanges". This will postback to the server. You will notice all 5 rows are still in an Added state.&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="BatchUpdateDeleteRow.aspx.cs" Inherits="BatchUpdateDeleteRow" %&amp;gt;
&amp;lt;%@ Register TagPrefix="iswebgrid" Namespace="ISNet.WebUI.WebGrid" Assembly="ISNet.WebUI.WebGrid" %&amp;gt;

&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" &amp;gt;
&amp;lt;HTML&amp;gt;
	&amp;lt;HEAD runat=server&amp;gt;
		&amp;lt;title&amp;gt;BatchUpdateDeleteRow&amp;lt;/title&amp;gt;
		&amp;lt;meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"&amp;gt;
		&amp;lt;meta name="CODE_LANGUAGE" Content="C#"&amp;gt;
		&amp;lt;meta name="vs_defaultClientScript" content="JavaScript"&amp;gt;
		&amp;lt;meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"&amp;gt;
		&amp;lt;script language="javascript"&amp;gt;
		    function WebGrid_SetFieldText(field, text, updateValueField) {
		        try {
		            // Set field's text
		            // NOTE: Default the value to the text if flag is not specified
		            if (field == null) { return; }
		            if (typeof (updateValueField) == "undefined") { updateValueField = true; }
		            field.SetText(text, updateValueField, true);
		        }
		        catch (ex) { ShowJSException(ex); }
		    }

		    function AddNewRowForceNewData() 
		    {
		        var grdInurings = ISGetObject("WebGrid1");
			
		        // Create new row
		        var newRow = grdInurings.RootTable.NewRow();
		        if (newRow == null) { return false; }

		        // Default new row's data
		        // NOTE: Scroll to row before new row to avoid lag from WebGrid loading more data (if exist)
		        grdInurings.ClearSelection();

		        // Address
		        var cells = newRow.GetCells();
		        var address = cells.GetNamedItem("Address");
		        if (address != null) { WebGrid_SetFieldText(address, ""); }

		        // Customer ID
		        var customerID = cells.GetNamedItem("CustomerID");
		        if (customerID != null) 
		        {
		            window.alert("Why does this field need to be set for a new row when the ID is not set until the data is committed?");
		            var now = new Date();
		            WebGrid_SetFieldText(customerID, String((now.getSeconds() &amp;#43; now.getMilliseconds())));
		        }
		        newRow.AddPendingChanges();

		        // Focus
		        newRow.Select();
		        
		        return true;
		    }

		    function AddNewRows(numOfNewRows, numOfDeleteRows) 
		    {
		        var grdInurings = ISGetObject("WebGrid1");
		        if (typeof (numOfDeleteRows) == "undefined") { numOfDeleteRows = 0; }		        
		        for (var index = 0; index &amp;lt; numOfNewRows; index&amp;#43;&amp;#43;)
		        {
		            var newRow = AddNewRow();
		            if (index &amp;lt; numOfDeleteRows) 
		            {
		                WebGrid_DeleteRow(newRow);
		            }
		        }
		        
		        return true;
		    }

		    function AddNewRow() 
		    {
		        // Create new row
		        var grdInurings = ISGetObject("WebGrid1");
		        var newRow = grdInurings.RootTable.NewRow();
		        if (newRow == null) { return false; }

		        // Default new row's data
		        // NOTE: Scroll to row before new row to avoid lag from WebGrid loading more data (if exist)
		        grdInurings.ClearSelection();

		        // Address
		        var cells = newRow.GetCells();
		        var address = cells.GetNamedItem("Address");
		        if (address != null) { WebGrid_SetFieldText(address, ""); }

		        // Customer ID
		        var customerID = cells.GetNamedItem("CustomerID");
		        if (customerID != null) 
		        {
		            var now = new Date();
		            WebGrid_SetFieldText(customerID, String((now.getSeconds() &amp;#43; now.getMilliseconds())));
		        }
		        newRow.AddPendingChanges();
		        return newRow;
		    }

		    function WebGrid_GetSelectedRow() 
		    {
		        try {
		            // Get selected row
		            var grid = ISGetObject("WebGrid1");
		            if (grid == null) { return; }
		            var selObj = grid.GetSelectedObject();
		            if (selObj == null) { return; }
		            return selObj.ToRowObject();
		        }
		        catch (ex) { ShowJSException(ex); }
		    }

		    function WebGrid_DeleteSelectedRow() 
		    {
		        try {
		            WebGrid_DeleteRow(WebGrid_GetSelectedRow());
		            
		        }
		        catch (ex) { ShowJSException(ex); }
		    }
		    
		    function WebGrid_DeleteRow(row)	
		    {
		        try 
		        {

		            if (row == null) { return; }
		            row.Delete();
		            row.AddPendingChanges();

		            var rowElement = row.GetElement();
		            //if (rowElement != null) { rowElement.style.display = "none"; }
		        }
		        catch (ex) { ShowJSException(ex); }
		    }
		&amp;lt;/script&amp;gt;
	&amp;lt;/HEAD&amp;gt;
	&amp;lt;body MS_POSITIONING="GridLayout"&amp;gt;
		&amp;lt;form id="Form1" method="post" runat="server"&amp;gt;
		&amp;lt;input type="button" value="New Row Causing More Data To Load" onclick="javascript:AddNewRowForceNewData();" /&amp;gt;
		&amp;lt;input type="button" value="Add 5 new rows and delete 2" onclick="javascript:AddNewRows(5, 2);" /&amp;gt;
		&amp;lt;input type="button" value="Delete Selected Row" onclick="javascript:WebGrid_DeleteSelectedRow();" /&amp;gt;
		&amp;lt;input type="button" value="Add 10 new rows" onclick="javascript:AddNewRows(10);" /&amp;gt;
		&amp;lt;asp:button runat="server" Text="Check WebRowChanges" OnClick="PerformInuringsGridBatchUpdate" /&amp;gt;
			&amp;lt;iswebgrid:webgrid id=WebGrid1 runat="server" Height="279px" Width="896px" 
			OnInitializeDataSource="WebGrid1_InitializeDataSource"&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="25"&amp;gt;
					&amp;lt;HeaderStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" ForeColor="Black" Height="20px"
						Font-Size="8pt" Font-Names="Verdana" BorderColor="#ACA899"&amp;gt;
						&amp;lt;BorderSettings&amp;gt;
							&amp;lt;Left Color="White"&amp;gt;&amp;lt;/Left&amp;gt;
							&amp;lt;Top Color="White"&amp;gt;&amp;lt;/Top&amp;gt;
						&amp;lt;/BorderSettings&amp;gt;
					&amp;lt;/HeaderStyle&amp;gt;
					&amp;lt;FrameStyle BackColor="#F1EFE2"&amp;gt;&amp;lt;/FrameStyle&amp;gt;
					&amp;lt;GroupByBox&amp;gt;
						&amp;lt;LabelStyle BorderStyle="Solid" BorderWidth="1px" BackColor="White" Font-Size="8pt" Font-Names="Verdana"
							BorderColor="Navy"&amp;gt;&amp;lt;/LabelStyle&amp;gt;
						&amp;lt;Style BackColor="Gray"&amp;gt;
						&amp;lt;/Style&amp;gt;
					&amp;lt;/GroupByBox&amp;gt;
					&amp;lt;EditTextboxStyle BorderStyle="None" BorderWidth="0px" Font-Size="8pt" Font-Names="Verdana"&amp;gt;&amp;lt;/EditTextboxStyle&amp;gt;
					&amp;lt;NewRowStyle BackColor="White" ForeColor="DarkGray" Font-Size="8pt" Font-Names="Verdana"&amp;gt;&amp;lt;/NewRowStyle&amp;gt;
					&amp;lt;FocusCellStyle BorderStyle="Solid" BorderWidth="1px" BorderColor="Navy"&amp;gt;&amp;lt;/FocusCellStyle&amp;gt;
					&amp;lt;RowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="White" Font-Size="8pt"
						Font-Names="Verdana"&amp;gt;&amp;lt;/RowStyle&amp;gt;
					&amp;lt;GroupRowInfoStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#F1EFE2" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="White"&amp;gt;
						&amp;lt;BorderSettings&amp;gt;
							&amp;lt;Bottom Color="Silver"&amp;gt;&amp;lt;/Bottom&amp;gt;
							&amp;lt;Right Color="Silver"&amp;gt;&amp;lt;/Right&amp;gt;
						&amp;lt;/BorderSettings&amp;gt;
					&amp;lt;/GroupRowInfoStyle&amp;gt;
					&amp;lt;SelectedRowStyle BackColor="LightSteelBlue"&amp;gt;&amp;lt;/SelectedRowStyle&amp;gt;
					&amp;lt;AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="AntiqueWhite"
						Font-Size="8pt" Font-Names="Verdana"&amp;gt;&amp;lt;/AlternatingRowStyle&amp;gt;
					&amp;lt;StatusBarStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="#ACA899"&amp;gt;
						&amp;lt;Padding Bottom="2px" Left="2px" Top="2px" Right="2px"&amp;gt;&amp;lt;/Padding&amp;gt;
					&amp;lt;/StatusBarStyle&amp;gt;
					&amp;lt;StatusBarCommandStyle&amp;gt;
						&amp;lt;Over BorderWidth="1px" BorderColor="Navy" BorderStyle="Solid" BackColor="CornflowerBlue"&amp;gt;&amp;lt;/Over&amp;gt;
						&amp;lt;Normal&amp;gt;
							&amp;lt;Padding Bottom="1px" Left="1px" Top="1px" Right="1px"&amp;gt;&amp;lt;/Padding&amp;gt;
						&amp;lt;/Normal&amp;gt;
						&amp;lt;Active BackColor="RoyalBlue" BaseStyle="Over"&amp;gt;&amp;lt;/Active&amp;gt;
					&amp;lt;/StatusBarCommandStyle&amp;gt;
					&amp;lt;PreviewRowStyle ForeColor="#0000C0"&amp;gt;&amp;lt;/PreviewRowStyle&amp;gt;
				&amp;lt;/LayoutSettings&amp;gt;
				&amp;lt;RootTable DataKeyField="CustomerID" Caption="Customers" GridLineStyle="NotSet"&amp;gt;
					&amp;lt;Columns&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="Address" DataMember="Address" Name="Address" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="City" DataMember="City" Name="City" 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="ContactName" DataMember="ContactName" Name="ContactName" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="ContactTitle" DataMember="ContactTitle" Name="ContactTitle" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="Country" DataMember="Country" Name="Country" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="Fax" DataMember="Fax" Name="Fax" 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;iswebgrid:WebGridColumn Caption="PostalCode" DataMember="PostalCode" Name="PostalCode" Width="100px"&amp;gt;&amp;lt;/iswebgrid:WebGridColumn&amp;gt;
						&amp;lt;iswebgrid:WebGridColumn Caption="Region" DataMember="Region" Name="Region" 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;/form&amp;gt;
	&amp;lt;/body&amp;gt;
&amp;lt;/HTML&amp;gt;

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ISNet.WebUI.WebGrid;

public partial class BatchUpdateDeleteRow : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
    {
        dsNorthwind.CustomersDataTable dt = new dsNorthwind.CustomersDataTable();
        dsNorthwindTableAdapters.CustomersTableAdapter da = new dsNorthwindTableAdapters.CustomersTableAdapter();
        da.Fill(dt);
        e.DataSource = dt;
    }

    /// &amp;lt;summary&amp;gt;
    /// Perform batch update on the Inurings WebGrid control's source
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="source"&amp;gt;Source to update&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;Updated source after batch update&amp;lt;/returns&amp;gt;
    public void PerformInuringsGridBatchUpdate(object sender, EventArgs e)
    {
        // Get changes
        List&amp;lt;WebGridRowChanges&amp;gt; rowChanges = this.WebGrid1.GetChanges();

        // Perform change updates
        foreach (WebGridRowChanges rowChangesItem in rowChanges)
        {
            if (rowChangesItem.KeyValue != null)
            {
                switch (rowChangesItem.RowState)
                {
                    // Add
                    case RowState.Added:

                        break;
                    // Update
                    case RowState.Modified:

                        break;
                    // Delete
                    case RowState.Deleted:
                        break;
                }
            }
        }
    }
}
&lt;/pre&gt;
</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Mon, 20 Sep 2010 00:20:28 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello Shawn,&lt;/p&gt;&lt;p&gt;As you have said before that you would get me a sample for this issue.&lt;br /&gt;I think it would be better for me to see the sample first. &lt;br /&gt;I need to replicate your issue to investigate your issue.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Fri, 17 Sep 2010 11:15:11 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;After calling the Row's Delete() method, the Row's &lt;span style="font-size: 13px"&gt;GetRowState() method still indicates the row is 'Added'. Shouldn't it be 'Delete'? How can I tell which rows have been deleted or marked for deleted?&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is a problem. A row that was created and then deleted still has a "GetRowState()" as "Added". After the postback, the WebRowChanges only has "Added" and not "Deleted" so the row is NEVER deleted.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;If I just DELETE an existing row, the WebRowChanges has the delete and it works as expected.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>How to delete rows using BatchUpdate scenario?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/</link><pubDate>Wed, 08 Sep 2010 15:03:37 GMT</pubDate><dc:creator>SAgosto</dc:creator><description>&lt;p&gt;Can someone provide me with an example on how to delete rows from a WebGrid using BatchUpdate using JavaScript? The following code doesn't seem to do anything? I would expect the row to disappear but show up in the grid's WebGridRowChanges collection&lt;/p&gt;&lt;pre&gt;function WebGrid_GetSelectedRow(controlID) 
{
    try
    {
        // Get selected row
        var grid = ISGetObject(controlID);
        if (grid == null) { return; }
        var selObj = grid.GetSelectedObject();
        if (selObj == null) { return; }
        return selObj.ToRowObject();
    }
    catch (ex) { ShowJSException(ex); }
}

function WebGrid_DeleteSelectedRow(controlID) 
{
    try 
    {
        // Delete selected row
        var row = WebGrid_GetSelectedRow(controlID);
        if (row == null) { return; }
        row.Delete();
    }
    catch (ex) { ShowJSException(ex); }
}&lt;/pre&gt;
</description></item></channel></rss>