User Profile & Activity

Shawn August Member
Page
of 19
Posted: December 8, 2010 10:02 AM

Hi Shawn,

The 'this.Column.ColumnType' is null or not an object because the it cant find the NewRow.

What if I suggest you using the one at our WebGrid's sample, Client_ProgrammaticEdit?

Hope this helps.

Thank you.

Regards,
Niven.

 

That is not the desired approach of my company.


Is there a way to catch an event when the user clicks the default "Add New Row" area that is reserved for the WebGrid's New Row? This would fix my problem as I would not have to rely on providing a mechanism (button and WebGrid's Context Menu function) to display a new row and default data. If not, I need a way to prevent the user from clicking the default "Add New Row" area

Posted: December 8, 2010 9:48 AM

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?

AFAIK the row state will be updated correctly if it is a newly added row.

 

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.

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreatyClaimsGrid.ascx.cs"
    Inherits="Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid" %>
    
<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %>    
<%@ Register Assembly="ISNet.WebUI.WebGrid"    Namespace="ISNet.WebUI.WebGrid"    TagPrefix="ISWebGrid"    %>
<%@ Register Assembly="AjaxControlToolkit"     Namespace="AjaxControlToolkit"     TagPrefix="ajaxToolKit"  %>

<script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_HASHTABLE_PATH)%>'></script>
<script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_POPUPS_VALIDATEFIELDS_PATH)%>'></script>
<script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_DATE_PATH)%>'></script>

<script type="text/javascript">
// -->

function <%=this.ClientID%>_GetGridCtrl() 
{ 
    try { return WebGrid_GetGrid(<%=this.ClientID%>_GetGridClientID()); }
    catch (ex) { ShowJSException(ex); }
} 

function <%=this.ClientID%>_GetGridClientID()
{
    try { return "<%=this.grdTreatyClaims.ClientID%>"; }
    catch (ex) { ShowJSException(ex); }
}

function <%=this.ClientID%>_GetIncurredMovementClientID()
{
    try { return "<%=this.txtIncurredMovement.ClientID%>"; }
    catch (ex) { ShowJSException(ex); }
}

function TreatyClaimsGrid_GettxtIncurredMovementCtrl()
{
    try { return document.getElementById(<%=this.ClientID%>_GetIncurredMovementClientID()); }
    catch (ex) { ShowJSException(ex); }
}

function <%=this.ClientID%>_GetTotalIncurredMovement()
{
    try 
    { 
        var value = "";
        var field = TreatyClaimsGrid_GettxtIncurredMovementCtrl;
        if (field != null) { value = field.value; }
        return value;
    }
    catch (ex) { ShowJSException(ex); }
}

function <%=this.ClientID%>_SetViewMode(viewMode)
{
    try
    {
        // Set View Mode
        var gridID = <%=this.ClientID%>_GetGridClientID();                
        switch(viewMode)
        {
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Outstanding%>":
                // Hide Claim related fields (Paid -> 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 -> 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
        <%=this.ClientID%>_SetViewMode("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Default%>");
        
        // Hide the Accept All Changes button
        WebGrid_ShowHideAcceptAllChangesButton(gridID, false); 

        // Initialize row
        var grdTreatyClaims = ISGetObject(gridID);
        if (grdTreatyClaims != null)
        {
            for (var i = 0; i < grdTreatyClaims.TotalRows; i++)
            {
                var row = grdTreatyClaims.RootTable.GetRow(i);
                InitializeRow(row);
                
                // Calculate Incurred
                CalculateIncurred(<%=this.ClientID%>_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 = "../..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_NEW_PATH%>";
        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(<%=this.ClientID%>_GetGridClientID());
        if (rowState == "Added" || rowState == "Unmodified")
        {        
            var deleteClaim = new WebMenuItem();
            deleteClaim.ImageURL = "../..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%>";
            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 "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>":
                EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", checkboxValue);              
                break;            
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>":
                EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", checkboxValue);              
                break;
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>":
                EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", checkboxValue);              
                break;
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>":
                EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", 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 "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>":
                <%=this.ClientID%>_LoadClaimCatCode(WebGrid_GetSelectedRow(controlID));
                break;              
            // Update IncludeOutstanding field
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", colValue);              
                break;            
            // Update IncludeOutstanding field                
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", colValue);              
                break;
            // Update IncludeOutstanding field
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", colValue);              
                break;
            // Update IncludeOutstanding field
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>":
                TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", 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 
        <%=this.ClientID%>_InitializeClaimRowFields(row);                      
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function <%=this.ClientID%>_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 = <%=this.ClientID%>_IsCATClaim(row);
       
        // Description
        var description = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>");
        if (description != null) { description.SetForceNoEdit((isCatClaim == false)); }
                
        // Level 1 Cat Code
        var level1CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>");
        if (level1CatCode != null) { level1CatCode.SetForceNoEdit((isCatClaim == false)); }
        
        // Level 3 Cat Code
        var level3CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>");
        if (level3CatCode != null) { level3CatCode.SetForceNoEdit((isCatClaim == false)); }               
        <%=this.ClientID%>_LoadClaimCatCode(row, false);
        
        // Cause Of Loss
        var causeOfLoss = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%>");
        if (causeOfLoss != null) { causeOfLoss.SetForceNoEdit((isCatClaim == false)); }        
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); }
    
    return returnVal;
}

function AddClaimRow()
{
    try 
    {
        // Get grid
        var grid = <%=this.ClientID%>_GetGridCtrl();
        if (grid == null) { return false; }
        
        // Create new row
        var newRowElement = grid.RootTable.GetNewRow();
        if (newRowElement == null) { return false; }
        var newRow = grid.RootTable.ToRowObject(newRowElement);
        if (newRow == null) { return false; }
                  
        // Focus New Row
        grid.ClearSelection();            
        WebGrid_SelectRow(<%=this.ClientID%>_GetGridClientID(), newRow, "<%=Endurance.Re.FWB.Data.Constants.SP_COL_GENIUSCLAIMAMOUNT_CLAIMTITLE%>");
             
        // Default new row's data		        
		<%=this.ClientID%>_DefaultClaimRow(newRow);
        newRow.SetDataChanged();
        grid.MarkEdit();                 
                        
        return true;
    }
    catch (ex) { ShowJSException(ex); }       
}    
    
function <%=this.ClientID%>_DefaultClaimRow(row)
{
    try
    {
        if (row == null) { return; }
        
        // Initalize the row's fields
        <%=this.ClientID%>_InitializeClaimRowFields(row);
       
        // Determine if CAT claim 
        var isCatClaim = <%=this.ClientID%>_IsCATClaim(row);
       
        // Description
        var rowCells = row.GetCells();
        var description = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>");
        if (description != null) {  WebGrid_SetFieldText(description, ""); }
        
        // Date Of Loss Qualififer
        var dateOfLossQualifier = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%>");
        if (dateOfLossQualifier != null) 
        { 
            WebGrid_SetDropDownListValue(dateOfLossQualifier, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); 
        }                     
        
        // Claims Made Date
        var claimsMadeDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>");
        if (claimsMadeDate != null)
        {
            var value = "";
            WebGrid_SetFieldText(claimsMadeDate, value);
        }
        
        // Reported Date
        var reportedDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%>");
        if (reportedDate != null)
        {
            var value = "";
            if (isCatClaim == false) { value = new Date(); }
            WebGrid_SetFieldText(reportedDate, value);
        }
        
        // Event Date
        var eventDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%>");
        if (eventDate != null)
        {
            var value = "";
            if (isCatClaim == false) { value = new Date(); }
            WebGrid_SetFieldText(eventDate, value);
        }
         
        // Level 1 Cat Code
        var level1CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>");
        if (level1CatCode != null) 
        { 
            var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>";
            var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>";            
            WebGrid_SetDropDownListValue(level1CatCode, text, value); 
        }  
        
        // Level 3 Cat Code
        var level3CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>");
        if (level3CatCode != null) 
        { 
            var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>";
            var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>";            
            WebGrid_SetDropDownListValue(level3CatCode, text, value); 
        }   
        
        // Cause Of Loss
        var causeOfLoss = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%>");
        if (causeOfLoss != null) 
        { 
            var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>";
            var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>";            
            WebGrid_SetDropDownListValue(causeOfLoss, text, value); 
        } 
                 
        // Misc. amount fields
        var fieldNameAndValueList = new Hashtable();
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>", 0);
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", "");
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", "");
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", "");
        fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", "");
        <%=this.ClientID%>_UpdateRowClaimDataByList(<%=this.ClientID%>_GetGridClientID(), fieldNameAndValueList, row);
        
        // ID
        // NOTE: This is done to avoid any validation on the DataKeyField being unique
        var id = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_UNIQUEID%>");
        if (id != null) 
        {
            var now = new Date();
            WebGrid_SetFieldText(id, (now.getSeconds() + 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("<%=this.btnCreateCATClaim.ClientID%>");
        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 "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>":
                colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>"; 
                break;
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>":
                colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>"; 
                break;
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>":
                colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>"; 
                break;
            case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>":
                colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>"; 
                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("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>").Value);
        var expenses = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>").Value);
        var salvage = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>").Value);
        var indOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>").Value);
        var currentINDOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INDOUTSTANDING%>").Value);
        var currentIND = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_IND%>").Value);
        var currentFEE = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_FEE%>").Value);
        var currentREC = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_REC%>").Value);
        var cashLoss = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>").Value);
        var refund = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>").Value);
        var claimPortfolioIn = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>").Value);
        var claimPortfolioOut = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>").Value);
        var currentIncurred = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>").Value);
        var incurred = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED%>");
        var incurredMovement = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>");
        var includeOS = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>");                                        
        
        // Check includeOS Checkbox to determine if the O/S value should be used in incurred movement calculation
        if (includeOS != null && 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 + currentFEE - currentREC + paid + expenses - salvage + indOutstanding + cashLoss - refund - claimPortfolioIn + 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, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>", null);
        WebGrid_SetFooterColumnValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>", TreatyClaimsGrid_FormatAmount(currentIncurred));

        // Update footer column
        var totalIncurredMovement = Math.abs(WebGrid_GetColumnAggregateValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>", null));
        WebGrid_SetFooterColumnValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>", 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 = <%=this.ClientID%>_GetFirstRow();
        if (row == null) { return false; }
                 
        // Update field
        TreatyClaimsGrid_UpdateField(gridID, row, WebGrid_GetField(row, fieldName), value);
    }
    catch (ex) { ShowJSException(ex); }
}

function <%=this.ClientID%>_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 = <%=this.ClientID%>_GetFirstRow();
        if (row == null) { return false; }
        
        // Update claim data
        <%=this.ClientID%>_UpdateRowClaimDataByList(gridID, fieldNameAndValueList, row);        
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }

    return returnVal;
}

function <%=this.ClientID%>_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 = <%=this.ClientID%>_GetGridCtrl();
        if (grid == null) { return false; }
        var rowCount = WebGrid_GetTotalRowCount(gridID);
        if (rowCount > 1 && forceUpdate == false) { return false; }
    }
    catch (ex) { ShowJSException(ex); }
    
    return true;
}

function TreatyClaimsGrid_UpdateField(gridID, row, field, value, updateField, calculateIncurred) 
{ 
    try
    {
        var grid = <%=this.ClientID%>_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 "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", value);
                    }
                    break;
                // FEEOutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", value);
                    }
                    break;                     
                // ACROutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", value);
                    }
                    break;    
                // ACEOutstanding
                // NOTE: Check/Uncheck based on if a value exists
                case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>":
                    if (row != null)
                    {                            
                        TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", 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 && 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(<%=this.ClientID%>_GetGridClientID());
    }
    catch (ex) { ShowJSException(ex); }
}   
     
/* Validate [START] */

function grdTreatyClaims_OnRowValidate(gridID, tableName, editObject)
{
    try 
    { 
        // Validate Row   
        return ValidateTreatyClaimsRow(WebGrid_GetSelectedRow(<%=this.ClientID%>_GetGridClientID()), true);
    }
    catch (ex) { ShowJSException(ex); }
}

function <%=this.ClientID%>_Validate(displayMsg) 
{ 
    var returnVal = false;
    
    try
    {
        var grid = <%=this.ClientID%>_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(<%=this.ClientID%>_GetGridClientID()) == true) { return true; }
        if (row.GetRowState() == "Deleted") { return true; }
        
        // Determine if CAT claim
        var isCATClaim = <%=this.ClientID%>_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("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>");
            var descriptionText = (description != null) ? description.Text : null;
            if (IsNullOrEmpty(descriptionText) == true) 
            {
                msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DESCRIPTION_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = description; }
            }
        }
            
        // Date Of Loss Qualifier
        if (isCATClaim == true)
        {            
            // Required
            var dateOfLossQualifier = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%>");            
            dateOfLossQualifierValue = (dateOfLossQualifier != null) ? dateOfLossQualifier.Value : null;
            if (IsNullOrEmpty(dateOfLossQualifierValue) == true || dateOfLossQualifierValue == "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>") 
            {
                msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DATEOFLOSSQUALIFIER_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = dateOfLossQualifier; }
            }                                               
        }    

        // Claims Made Date
        if (isCATClaim == true)
        {
            // Required
            var claimsMadeDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"); 
            var claimsMadeDateObj = (claimsMadeDate != null) ? parseDate(claimsMadeDate.Text) : null;       
            if (IsNullOrEmpty(claimsMadeDateObj) == true) 
            {
                msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
            }                                    
            else
            {
                // Cannot be greater than today
                if (claimsMadeDateObj > new Date()) 
                {
                    msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_GREATERTHANTODAY%>");
                    if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
                }
            
                // Cannot be before policy's effective date                      
                var dateInception = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCEPTIONDATE%>"); 
                var dateInceptionObj = (dateInception != null) ? parseDate(dateInception.Text) : null;
                if (claimsMadeDateObj < dateInceptionObj) 
                {
                    msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_BEFOREPOLICYEFFECTIVEDATE%>" + " (" + dateInception.Text + ")");
                    if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; }
                }
            }
        }  
                
        // Reported Date
        if (isCATClaim == true)
        {
            // Required
            var dateReported = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%>");
            var dateReportedObj = (dateReported != null) ? parseDate(dateReported.Text) : null;
            if (IsNullOrEmpty(dateReportedObj) == true) 
            {
                msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
            } 
            else
            {
                // Cannot be greater than today
                if (dateReportedObj > new Date()) 
                {
                    msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_GREATERTHANTODAY%>");
                    if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
                }
            
                // Cannot be before claim's made/DOL date
                var dateClaimsMade = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"); 
                var dateClaimsMadeObj = (dateClaimsMade != null) ? parseDate(dateClaimsMade.Text) : null;
                if (dateReportedObj < dateClaimsMadeObj) 
                {
                    msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_BEFORECLAIMSMADEDATE%>" + " (" + dateClaimsMade.Text + ")");
                    if (_fieldToFocus == null) { _fieldToFocus = dateReported; }
                }
            }                                                          
        }

        // Event Date
        if (isCATClaim == true && dateOfLossQualifierValue == "<%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_DATEOFLOSSQUALIFIER_CLAIMSMADE_VALUE%>")
        {
            // Required
            var dateEvent = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%>");
            var dateEventObj =  (dateEvent != null) ? parseDate(dateEvent.Text) : null;
            if (IsNullOrEmpty(dateEventObj) == true) 
            {
                msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = dateEvent; }
            }  
            else
            {
                // Cannot be greater than today
                if (dateEventObj > new Date()) 
                {
                    msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_INVALID_GREATERTHANTODAY%>");
                    if (_fieldToFocus == null) { _fieldToFocus = dateEvent; }
                }                                                        
            }                
        }        
        
        // Display validation message
        // NOTE: Add Description to caption if specified
        if (msg != null && msg.length > 0)
        {
            // Display
            // NOTE: Select row after display       
            if (displayMsg == true)
            {
                var caption = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_VALIDATION_FAILED%>";
                if (IsNullOrEmpty(descriptionText) == false) { caption += " - Description: " + descriptionText; }
                WebDialogBox_ShowDialog(caption, Array_GetList(msg, "<%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%>"), "OK", <%=this.ClientID%>_FocusRow); 
            }                    
            return false;
        }
        return true;
    }
    catch (ex) { ShowJSException(ex); }             
}

function <%=this.ClientID%>_IsAmountExist() 
{ 
    try
    {
        // Check if an amount is specified       
        var grid = <%=this.ClientID%>_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 (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>") == true) { return true; }
                    
                    // Expenses
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>") == true) { return true; }

                    // Salvage
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>") == true) { return true; }

                    // Cash Loss
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>") == true) { return true; }
        
                    // Refund
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>") == true) { return true; }
        
                    // Claim Portfolio In
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>") == true) { return true; }
                    
                    // Claim Portfolio Out
                    if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>") == true) { return true; }
                    
                    // IND Outstanding
                    if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", rowCells) == true)
                    {
                        if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>") == true) { return true; }
                    }
                    
                    // FEE Outstanding
                    if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", rowCells) == true)
                    {
                        if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>") == true) { return true; }                       
                    }
                    
                    // ACR Outstanding
                    if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", rowCells) == true)
                    {
                        if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>") == true) { return true; }                       
                    }
                    
                    // ACE Outstanding
                    if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", rowCells) == true)
                    {
                        if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>") == true) { return true; }                     
                    }                    
                }
            }
        }       
    }
    catch (ex) { ShowJSException(ex); returnVal = false;}                       
    
    return false;
}

function <%=this.ClientID%>_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) > 0);       
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }                       
    
    return returnVal;
}

function <%=this.ClientID%>_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) > 0);       
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }                       
    
    return returnVal;
}

function <%=this.ClientID%>_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(<%=this.ClientID%>_GetGridClientID(), _fieldToFocus.Row, _fieldToFocus.Name);                 
        _fieldToFocus = null;  
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }     
    
    return returnVal;
}
        
/* Validate [END] */
   
function <%=this.ClientID%>_LoadClaimCatCode(row, defaultList)
{
    var returnVal = false;
    
    try
    {
        // Load Catastrophe Code data for CAT Claims only
        if (row == null) { return false; }
        if (<%=this.ClientID%>_IsCATClaim(row) == false) { return false; }        
        
        // Get DOL
        var claimsMadeDateObj = parseDate(WebGrid_GetFieldValue(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"));        
        
        // Load Claim's Level 1 and Level 3 Catastrophe Code data  
        if (typeof(defaultList) == "undefined") { defaultList = true; }                   
        <%=this.ClientID%>_LoadClaimCatCodeControl(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>", claimsMadeDateObj, _GeniusClaimLevel1CatCode, defaultList);
        <%=this.ClientID%>_LoadClaimCatCodeControl(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>", claimsMadeDateObj, _GeniusClaimLevel3CatCode, defaultList);
               
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}

function <%=this.ClientID%>_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 = $("#" + <%=this.ClientID%>_GetGridClientID() + "__" + 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) <= dateOfLoss &&
                JSON_ToDate(item.CatastropheDateOfLossTo) >= 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 = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>";
                var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>";   
                WebGrid_SetDropDownListValue(catCodeField, text, value);  
            }
        }
        
        returnVal = true;
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}
    
function <%=this.ClientID%>_IsCATClaim(row)
{
    var returnVal = false;
    
    try
    {
        // Determine if the claim is a Catastrophe claim
        if (row == null) { return false; }
        var level1CatValue = WebGrid_GetFieldValue(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>");
        returnVal = (level1CatValue != "<%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_TYPE_BLOCK_VALUE%>");
    }
    catch (ex) { ShowJSException(ex); returnVal = false; }
    
    return returnVal;
}
    
function <%=this.ClientID%>_GetFirstRow()
{
    var row = null;
    
    try
    {
        // Get 1st claim
        var grid = <%=this.ClientID%>_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); }
}

// -->
</script>   

<table style="table-layout:fixed;width:100%;height:100%">
<tr>
    <td>
        <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()" />
    </td>
</tr>
<tr>
    <td>
        <div class="ContentTemplateGridContent">
            <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">
            </div>
            <asp:TextBox runat="server" ID="txtIncurredMovement" CssClass="HideControl" />
            <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">
                <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">
                    <ClientSideEvents OnInitialize="grdTreatyClaims_OnInitialize" OnRowContextMenu="grdTreatyClaims_OnRowContextMenu"
                        OnCheckBoxClick="grdTreatyClaims_OnCheckBoxClick" 
                        OnExitEditMode="grdTreatyClaims_OnExitEditMode"
                        OnAfterExitEditMode="grdTreatyClaims_OnAfterExitEditMode" 
                        OnRowValidate="grdTreatyClaims_OnRowValidate" />
                    <FrameStyle>
                        <BorderSettings>
                            <Top Style="none" />
                            <Bottom Style="none" />
                            <Left Color="#6593cf" Style="solid" Width="1" />
                            <Right Color="#6593cf" Style="solid" Width="1" />
                        </BorderSettings>
                    </FrameStyle>
                    <HeaderStyle CssClass="WebGridHeaderStyle" />
                    <StatusBarStyle CssClass="WebGridStatusBarStyle" />
                    <StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" Normal-CssClass="WebGridStatusBarCommandStyleNormal"
                        Over-CssClass="WebGridStatusBarCommandStyleOver">
                        <Normal CssClass="WebGridStatusBarCommandStyleNormal" />
                        <Over CssClass="WebGridStatusBarCommandStyleOver" />
                        <Active CssClass="WebGridStatusBarCommandStyleActive" />
                    </StatusBarCommandStyle>
                    <FilterRowStyle CssClass="WebGridFilterRowStyle" />
                    <PreviewRowStyle CssClass="WebGridRowStyle" />
                    <RowStyle CssClass="WebGridRowStyle" />
                    <QuickFilterBarStyle CssClass="WebGridRowStyle" />
                    <RowHeaderStyle CssClass="WebGridRowHeaderStyle" />
                    <SelectedRowStyle CssClass="WebGridSelectedRowStyle" />
                    <EditFocusCellStyle CssClass="WebGridRowStyle" />
                    <FocusCellStyle CssClass="WebGridRowStyle" />
                    <LostFocusRowStyle CssClass="WebGridRowStyle" />
                    <NewRowStyle CssClass="WebGridRowStyle" />
                    <SortedColumnStyle CssClass="WebGridSortedColumnStyle" />
                    <AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" />
                    <EditTextboxStyle CssClass="WebGridEditTextboxStyle" />
                    <FreezePaneSettings AbsoluteScrolling="True" ActiveFrozenColumns="3" MaxFrozenColumns="3"
                        ShowInContextMenu="False" ShowSplitterLine="False" SplitterLineColor="ActiveBorder"
                        SplitterLineWidth="1" />
                </LayoutSettings>
                <RootTable Caption="Claims Transaction" DataKeyField="UniqueID" ColumnFooters="Yes">                
                    <Columns>
                        <ISWebGrid:WebGridColumn Caption="UniqueID" Name="UniqueID" DataType="System.Integer"
                                                 ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit"
                                                 Width="0px" Visible="false">
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                                                                    
                        <ISWebGrid:WebGridColumn Caption="Claim Number" Name="ClaimMasterReference" DataMember="ClaimMasterReference"
                            DataType="System.String" EditType="NoEdit" FilterEditType="TextBox" Width="150px"
                            FooterText="Total">
                        </ISWebGrid:WebGridColumn>                                
                        <ISWebGrid:WebGridColumn Caption="Description" Name="ClaimTitle" DataMember="ClaimTitle"
                            DataType="System.String" EditType="TextBox" FilterEditType="TextBox" Width="275px">
                        </ISWebGrid:WebGridColumn>                                
                        <ISWebGrid:WebGridColumn Caption="Date of Loss Qualifier" Name="DateOfLossQualifier" DataMember="DateOfLossQualifier"
                            DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="125px">
                        </ISWebGrid:WebGridColumn> 
                        <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">
                        </ISWebGrid:WebGridColumn>                                                                                                                
                        <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">
                        </ISWebGrid:WebGridColumn>   
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Level 1 Cat" Name="ClaimLevel1CATCode" DataMember="ClaimLevel1CATCode"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="100px">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Level 3 Cat" Name="ClaimLevel3CATCode" DataMember="ClaimLevel3CATCode"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="100px">
                        </ISWebGrid:WebGridColumn>                            
                        <ISWebGrid:WebGridColumn Caption="Cause of Loss" Name="LossAnalysis1Code" DataMember="LossAnalysis1Code"
                            DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                            FilterEditType="DropdownList" Width="120px">
                        </ISWebGrid:WebGridColumn>
                        
                        
                        <ISWebGrid:WebGridColumn Caption="Paid" Name="Paid" DataMember="Paid" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Expenses" Name="Expenses" DataMember="Expenses" DataFormatString="#,##0.00" 
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox"
                            Width="80px" AggregateFunction="Sum">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Salvage" Name="Salvage" DataMember="Salvage" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum">
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Refund" Name="Refund" DataMember="Refund" DataFormatString="#,##0.00"
                            DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px"
                            AggregateFunction="Sum">
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                        
                        
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption=" " Name="IncludeINDOutstanding" DataMember="IncludeINDOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px">
                        </ISWebGrid:WebGridColumn>                          
                        <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">
                        </ISWebGrid:WebGridColumn>
                        
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption=" " Name="IncludeFEEOutstanding" DataMember="IncludeFEEOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px">
                        </ISWebGrid:WebGridColumn>                          
                        <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">
                        </ISWebGrid:WebGridColumn>
                                                                                
                        <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">                              
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption=" " Name="IncludeACROutstanding" DataMember="IncludeACROutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px">
                        </ISWebGrid:WebGridColumn>                          
                        <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">
                        </ISWebGrid:WebGridColumn>
                        
                        <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">                              
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption=" " Name="IncludeACEOutstanding" DataMember="IncludeACEOutstanding"
                            ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px">
                        </ISWebGrid:WebGridColumn>                          
                        <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">
                        </ISWebGrid:WebGridColumn>                       
  
  
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <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">                            
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <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">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Incurred" Name="Incurred" DataMember="" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit" 
                            AggregateFunction="Sum" Visible="false">
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Movement" Name="IncurredMovement" DataMember="" DefaultValue="0"
                            DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit"
                            AggregateFunction="Sum" Visible="false">
                        </ISWebGrid:WebGridColumn>
                    </Columns>
                </RootTable>
            </CommonCtrl:EnduranceWebGrid>
        </div>
    </td>
</tr>
</table>

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); }
}

Using the latest WebInput 4, I could not replicate the issue you mention. The javascript snippet you provide will correctly displayed "07-Dec-2010" in en-GB culture.

The latest WebInput 4 and WebUI Framework 3 build is 7 and 756 respectively. In order to check the latest release build please navigate to Intersoft Support Page.

 

I am using WebInput Version 3.0.7200.216. I will update to the latest WebInput version and re-test in the next couple of days. I will post my findings to help others.

 EDIT: I just confirmed that the latest version 4.0.7200.7 fixes this bug. Fantastic. Thank you.

 

Thank you!

Posted: December 7, 2010 6:06 PM

If you wish to remove newly added row during batchupdate, you will need to invoke UndoChanges method. The Delete 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 GetRowState function. Here is the snippet:

function DeleteRow() {
var grid = ISGetObject("WebGrid1");
var selObj = grid.GetSelectedObject();
var rowObj = selObj.ToRowObject()

if (rowObj.GetRowState() == "Added")
rowObj.UndoChanges();
else
rowObj.Delete();
}

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 I need to automate this. Also, that won't work if another row does not exist.

A possible fix would be to use the FrozenColumns property to force the column to always be visible but that is not desired by my users. Can you confirm this bug and is there a fix in place or a work around? Than

<FreezePaneSettings AbsoluteScrolling="True" ActiveFrozenColumns="3" MaxFrozenColumns="3"
                        ShowInContextMenu="False" ShowSplitterLine="False" SplitterLineColor="ActiveBorder"
                        SplitterLineWidth="1" />

 

Posted: December 6, 2010 4:59 PM

I got news from WebGrid development team regarding this issue. After being investigated further by the team, I need to re-clarify that this issue is not bug.

James is correct. Please try to implement the value list in InitializeLayout event rather than PrepareDataBinding server side event. This should solve the issue.

For James: thank you very much for your contribution in our community forum.

 

I had the same problem and I moved the loading of the WebValueLookups to the InitializeLayout event and the columns now defaulted the TEXT instead of VALUE.

Posted: December 3, 2010 11:03 AM

I wasn't clear with my request.

 

I am currently using a button to trigger a new row. This is necessary because I need to perform some logic to default data, enable/disable fields, etc. and I could not find a way to do that when the user clicks the default "New Row".  I hoped by hiding this row that I could only provide 1 way for the user to create a row: the button. My implementation removes the row so they cannot click but it comes back as I have shown you.

 

However, I am now getting an error because the button uses the "NewRow" object to create a new row;

 

'this.Column.ColumnType' is null or not an object

I finally got a chance to review this.  There were multiple problems with my code:

 

grid.MarkEdit(); was done BEFORE the NewRow's Focus() was called causing the ActiveEditCell.rowElement' is null or not an object as I mentioned above.  This should be considered a bug and fixed.

 

The retrieve of the NewRow should use the GetNewRow() method instead of the NewRow() method. It only worked after this was done. Can someone explain the difference?

var newRowElement = grid.RootTable.GetNewRow();
var newRow = grid.RootTable.ToRowObject(newRowElement);

instead of 

var newRow = grid.RootTable.NewRow();

 

The NewRow's Focus() must be done BEFORE the WebGrid's MarkEdit() method

The WebGrid.ClearSelection() must be done BEFORE the NewRow's Focus() and the Grid's MarkEdit() method (A row MUST be focused -- Again, not sure why)

 

Here's an example of the code with some custom methods but the logic flow is clear:

        // Get grid
        var grid = <%=this.ClientID%>_GetGridCtrl();
        if (grid == null) { return false; }
        
        // Create new row
        var newRowElement = grid.RootTable.GetNewRow();
        if (newRowElement == null) { return false; }
        var newRow = grid.RootTable.ToRowObject(newRowElement);
        if (newRow == null) { return false; }
                             
        // Focus New Row
        grid.ClearSelection();            
        WebGrid_SelectRow(<%=this.ClientID%>_GetGridClientID(), newRow, "<%=Endurance.Re.FWB.Data.Constants.SP_COL_GENIUSCLAIMAMOUNT_CLAIMTITLE%>");
             
        // Default new row's data		        
        <%=this.ClientID%>_DefaultClaimRow(newRow);
        newRow.SetDataChanged();
        grid.MarkEdit();  

Now, the OnRowValidate event STILL DOESN'T execute as the user tries to leave the row.   The only fix I can think of is to take an existing field and update it with the current text to trick the row into thinking it is dirty. Is there a property that allows me to indicate a row or a cell is dirty to force the OnRowValidated event to fire?

I apologize for any inconvenience this problem may have caused you. Finally, I was able to reproduce the issue on my end.

I have forwarded this issue to WebGrid development team to be fixed. The issue is filed under work item #863 of WebGrid 7.
I’ll keep you updated with any news I heard from the team regarding work item #863.

 

Thank you for the fast update. Can you respond to this thread when the bug is resolved? Thanks.

Posted: December 1, 2010 9:48 AM

Hi Shawn,

I believe you can't achieve that on server side.

After I investigate further, why the row's initial column be able to be invoked because the code you give to me only access the new row not the row header(row's initial column). And we have not supported the row header yet.

Please try the following solution to hide the new row on window::onload method.

function window::onload(){
    var grid = ISGetObject("WebGrid1");
    grid.RootTable.GetNewRow().style.display = "none";
    grid.Refresh();
}

Hope this helps. Please let me if this works on your side or not.

Thank you and have a nice day.

Regards,
Niven.

 

Isn't this JS code the same as the server code that I am currently using? Regardless, any solution where a WebGrid's Refresh method is used causing a postback cannot be used due to performance.

 

All times are GMT -5. The time now is 7:39 AM.
Previous Next