User Profile & Activity

Shawn August Member
Page
of 19
Posted: September 24, 2010 1:49 PM

By default, there is no property or methods that can be used to implement your specific scenario, to disable WebPane include underlying controls that located inside.

I’d like to offer a solution by using following Javascript function. Here is the scenario of the test page in my local end. There is a page that has a simple layout of WebPaneManager. In the “Header” pane, a WebCombo is added. Yet, an HTML button is added into the page. This button will be used to toggle the disable condition of the “Header” pane (include its underlying controls).

The idea is quite simple. First, get the div element of the content from the specific pane that we would like to disable/enable. Next, iterates through the childNodes of the content and set its disabled property to false or true.

function button1_onclick() {
    var WebPaneManager1 = ISGetObject("WebPaneManager1");
    var divContainer = WebPaneManager1.RootGroupPane.Panes[0].GetContentDivElement();

    toggleDisabled(divContainer);

    return true;
}

function toggleDisabled(el) {
    try {
        el.disabled = el.disabled ? false : true;
    }
    catch (E) {
    }

    if (el.childNodes && el.childNodes.length > 0) {
        for (var x = 0; x < el.childNodes.length; x++) {            
            toggleDisabled(el.childNodes[x]);
        }
    }
    return true;
}

I enclosed my test page as attachment. Please have the attach sample tested on your end and let us know whether it helps or not.

 

Thank you. This works good. The only issue is that you get a JS error if you click on the Grid's FilterRow ARROW icon. That's not a big deal. Do you think there is a way to speed it up? Or is the only wat recursion?

The newRow.Select() in my sent sample is used to select the “new row” object of the grid. The new object is obtained from the result of ToRowObject(newRowElement) method.

After inspect the AddNewInuring() Javascript function, I found out that you are using grid.RootTable.NewRow(). Please try to use GetNewRow() method to obtain the element of new row. After the element is obtained, please use ToRowObject() method and pass the new row element into the ToRowObject() method.

Hope this helps.

 

I replaced the AddNewInuring() JavaScript function with your example word-for-word except the WebGrid name was changed.


The newRow.GetCells() method fails:

 

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

I made a simple test based on your information regarding the scenario.

In my test page, I added a button that will invoke Button1_onclick() Javascript function. The Button1_onclick() Javascript function is used to set the default value in new row.

Next, after clicking the button, users can add their own data on the fields of the new row. The new row is added after user click Shift + Enter or press Tab button on the last cell of new row. When new row is added, OnRowValidate client-side event is fired.

I enclosed my test page as attachment. Please have the attached sample tested on your end.


If I modify an existing page in the tutorial with the code above, it works fine.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PreventLeavingRowIfValidationIsInvalid.aspx.cs"
    Inherits="PreventLeavingRowIfValidationIsInvalid" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Sample File</title>
    <script language="javascript" type="text/javascript">
        <!--
        function Button1_onclick() {
            var grid = ISGetObject("WebGrid1");
            var newRowElement = grid.RootTable.GetNewRow();
            var newRow = grid.RootTable.ToRowObject(newRowElement);

            newRow.Select();

            var cells = newRow.GetCells();
            cells.GetNamedItem("CompanyName").SetText("new company", true);
            newRow.SetDataChanged();
            grid.MarkEdit();

            return true;
        }

        function WebGrid1_OnRowValidate(rowObject) {
            //put your validation code in here

            return true;
        }
        -->
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="Button1" type="button" value="Add new row" onclick="return Button1_onclick()" />
        <ISWebGrid:WebGrid ID="WebGrid1" runat="server" DataSourceID="AccessDataSource1"
            Height="250px" UseDefaultStyle="True" Width="500px">
            <LayoutSettings AllowAddNew="Yes" AllowDelete="Yes" AllowEdit="Yes" AllowBatchUpdate="true">
                <BatchUpdateSettings AllowReviewChanges="True" NotifyOnLostFocus="True" />
                <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate" />
            </LayoutSettings>
            <RootTable DataKeyField="ShipperID">
                <Columns>
                    <ISWebGrid:WebGridColumn Caption="ShipperID" DataMember="ShipperID" DataType="System.Int32"
                        Name="ShipperID" Width="100px">
                    </ISWebGrid:WebGridColumn>
                    <ISWebGrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName"
                        Width="100px">
                    </ISWebGrid:WebGridColumn>
                    <ISWebGrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px">
                    </ISWebGrid:WebGridColumn>
                </Columns>
            </RootTable>
        </ISWebGrid:WebGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Northwind.mdb"
            DeleteCommand="DELETE FROM [Shippers] WHERE [ShipperID] = ?" InsertCommand="INSERT INTO [Shippers] ([ShipperID], [CompanyName], [Phone]) VALUES (?, ?, ?)"
            SelectCommand="SELECT * FROM [Shippers]" UpdateCommand="UPDATE [Shippers] SET [CompanyName] = ?, [Phone] = ? WHERE [ShipperID] = ?">
            <DeleteParameters>
                <asp:Parameter Name="ShipperID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ShipperID" Type="Int32" />
                <asp:Parameter Name="CompanyName" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="CompanyName" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="ShipperID" Type="Int32" />
            </UpdateParameters>
        </asp:AccessDataSource>
    </div>
    </form>
</body>
</html>

 

But, this fails in my page and I cannot figure out why. 

The Row.Select() causes an exception: "'type' is null or not an object"

function AddNewInuring() 
    {
        debugger;
        var grid = ISGetObject("<%=this.grdInurings.ClientID%>");
        // var newRowElement = grid.RootTable.GetNewRow();
        // var newRow = grid.RootTable.ToRowObject(newRowElement);
        var newRow = grid.RootTable.NewRow();
        if (newRow == null) { return false; }
        newRow.Select();

        var cells = newRow.GetCells();
        cells.GetNamedItem("TreatyName").SetText("new company", true);
        newRow.SetDataChanged();
        grid.MarkEdit();

        return true;
    }

 Commenting out Row.Select() method brings up another exception when the Grid's MarkEdit() method: ActiveEditCell.rowElement' is null or not an object

    function AddNewInuring() 
    {
        debugger;
        var grid = ISGetObject("ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_esScenarioAdjustments_wtScenarioAdjustments_ViewtabInurings_irInurings_wpmPage_ViewContentShell_grdInurings");
        // var newRowElement = grid.RootTable.GetNewRow();
        // var newRow = grid.RootTable.ToRowObject(newRowElement);
        var newRow = grid.RootTable.NewRow();
        if (newRow == null) { return false; }
        //newRow.Select();

        var cells = newRow.GetCells();
        cells.GetNamedItem("TreatyName").SetText("new company", true);
        newRow.SetDataChanged();
        grid.MarkEdit();

        return true;
     

 

Here's the entire page:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Inurings.ascx.cs" Inherits="Endurance.Re.AWB.Web.AWBWebControls.General.Inurings" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid"                  Namespace="ISNet.WebUI.WebGrid"     TagPrefix="ISWebGrid"    %>
<%@ Register Assembly="ISNet.WebUI.WebDesktop"               Namespace="ISNet.WebUI.WebDesktop"  TagPrefix="ISWebDesktop" %>
<%@ Register Assembly="ISNet.WebUI.WebInput"                 Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput"   %>
<%@ Register Assembly="AjaxControlToolkit"                   Namespace="AjaxControlToolkit"      TagPrefix="ajaxToolKit"  %>

<script language="javascript" type="text/javascript">
// <!--
    AttachEvent(window, "resize", function() { ForceGridResize(); });   
    
    function ForceGridResize()
    {
        try 
        {
            window.setTimeout(function() { wgDoResize(true, true); }, 100);
            window.setTimeout(function() { wgDoResize(true, true); }, 200);                      
        }
        catch (e) { }
    }

    function grdInurings_OnInitialize() 
    {
        try 
        {
            // Hide Portfolio ID List after render to allow update at run-time
            EnduranceGrid_ShowHideColumnByPos("<%=this.grdInurings.ClientID%>", WebGrid_GetColumnIndexByName("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>"), false);
        }
        catch (ex) { ShowJSException(ex); }
    }
        
    function wtbPageToolbar_OnClick() 
    {
        try 
        {
            // Create Inuring
            AddNewInuring();
        }
        catch (ex) { ShowJSException(ex); }
    }

    function AddNewInuring() 
    {
        debugger;
        var grid = ISGetObject("<%=this.grdInurings.ClientID%>");
        // var newRowElement = grid.RootTable.GetNewRow();
        // var newRow = grid.RootTable.ToRowObject(newRowElement);
        var newRow = grid.RootTable.NewRow();
        if (newRow == null) { return false; }
        newRow.Select();

        var cells = newRow.GetCells();
        cells.GetNamedItem("TreatyName").SetText("new company", true);
        newRow.SetDataChanged();
        grid.MarkEdit();

        return true;
    }
		    
    function asdasd()
    {
        try 
        {                                      
            // Get grid
            var grdInurings = ISGetObject("<%=this.grdInurings.ClientID%>");
            if (grdInurings == null) { return false; }
            
            // Create new row
            var newRow = grdInurings.RootTable.NewRow();
            if (newRow == null) { return false; }
                                 
            // Default new row's data
            grdInurings.ClearSelection();            
            DefaultNewInuringRow(newRow);
            newRow.SetDataChanged();
            grdInurings.MarkEdit();

            // Focus
           // WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", newRow);
            //"<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>");
                            
            return true;
        }
        catch (ex) { ShowJSException(ex); }       
    }    
        
    function DefaultNewInuringRow(row)
    {
        try
        {                
            if (row == null) { return; }
                                   
            // Selected
            var cells = row.GetCells();
            if (cells == null) { return; }                       
            var selected = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISSELECTED%>");
            if (selected != null) { selected.SetValue(false, true); }   
            
            // Treaty Name             
            var treatyName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>");
            if (treatyName != null) { WebGrid_SetFieldText(treatyName, ""); }
            
            // Portfolio Name List            
            UpdatePortfolioData(row, null);
            
            // Cedant Name
            var cedantName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CEDANTNAME%>");
            if (cedantName != null) { WebGrid_SetFieldText(cedantName, ""); }
            
            // Inuring Structure
            var inuringStructure = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGTYPE_ID%>");
            if (inuringStructure != null) 
            { 
                WebGrid_SetDropDownListValue(inuringStructure, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); 
            }
            
            // Currency Code
            var currencyCode = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_CURRENCYCODE%>");
            if (currencyCode != null) { WebGrid_SetFieldText(currencyCode, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_CURRENCYCODE_DEFAULT_VALUE%>"); }
            
            // Occurrency Limit            
            var occurrenceLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_OCCURRENCELIMIT%>");
            if (occurrenceLimit != null) { WebGrid_SetFieldText(occurrenceLimit, "0"); }
            
            // Attachment
            var attachment = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENT%>");
            if (attachment != null) { WebGrid_SetFieldText(attachment, "0"); }
            
            // Risk Limit
            var riskLimit = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RISKLIMIT%>");
            if (riskLimit != null) { WebGrid_SetFieldText(riskLimit, "0"); }
             
            // Retention
            var retention = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_RETENTION%>");
            if (retention != null) { WebGrid_SetFieldText(retention, "0"); }
            
            // Placed
            var placed = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PLACED%>");
            if (placed != null) { WebGrid_SetFieldText(placed, "0"); }
            
            // Covered
            var covered = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERED%>");
            if (covered != null) { WebGrid_SetFieldText(covered, "0"); }
            
            // Effective Date
            var effectiveDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%>");
            if (effectiveDate != null) { WebGrid_SetFieldText(effectiveDate, ""); }
            
            // Expiration Date
            var expirationDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%>");
            if (expirationDate != null) { WebGrid_SetFieldText(expirationDate, ""); }
            
            // Premium
            var premium = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PREMIUM%>");
            if (premium != null) { WebGrid_SetFieldText(premium, "0"); }
            
            // Coverage Basis
            var coverageBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_COVERAGEBASISTYPE_ID%>");
            if (coverageBasis != null) 
            { 
                WebGrid_SetDropDownListValue(coverageBasis, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); 
            }
            
            // Attachment Basis
            var attachmentBasis = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ATTACHMENTBASISTYPE_ID%>");
            if (attachmentBasis != null) 
            { 
                WebGrid_SetDropDownListValue(attachmentBasis, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); 
            }
            
            // Priority
            var priority = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_PRIORITY%>");
            if (priority != null) { WebGrid_SetFieldText(priority, "1"); }
            
            // Number of Reinstatements
            var numReinstatements = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_NUMREINSTATEMENTS%>");
            if (numReinstatements != null) { WebGrid_SetFieldText(numReinstatements, "1"); }
            
            // Reinstatement Charge
            var reinstatementCharge = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_REINSTATEMENTCHARGE%>");
            if (reinstatementCharge != null) { WebGrid_SetFieldText(reinstatementCharge, "0"); }
            
            // Source
            var source = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_SOURCE%>");
            if (source != null) { WebGrid_SetFieldText(source, "<%=Endurance.Re.AWB.Utility.AWBConstants.INURING_SOURCE_USER_DEFAULT_TEXT%>"); } 
            
            // Inuring Notes
            var inuringNotes = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_INURINGNOTES%>");
            if (inuringNotes != null) { WebGrid_SetFieldText(inuringNotes, ""); }
            
            // ID
            // NOTE: This is done to avoid any validation on the DataKeyField being unique
            var id = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ID%>");
            if (id != null) 
            {
                var now = new Date();
	            WebGrid_SetFieldText(id, (now.getSeconds() + now.getMilliseconds()));
            }
        }
        catch (ex) { ShowJSException(ex); }              
    }        
    
    function grdInurings_OnRowValidate(gridID, tableName, editObject)
    {
        try 
        { 
            // Validate Row   
            return ValidateInuringRow(WebGrid_GetSelectedRow("<%=this.grdInurings.ClientID%>"));
        }
        catch (ex) { ShowJSException(ex); }
    }
    
    function <%=this.ClientID%>_Validate() 
    { 
        try
        {
            var grid = WebGrid_GetGrid("<%=this.grdInurings.ClientID%>");
            if (grid == null) { return true; }
            
            // Get grid's RowChanges
            var rowChanges = grid.GetChanges();
            if (rowChanges == null) { return true; }
            
            // Validate each row
            for(var index in rowChanges)
            {
                var validate = ValidateInuringRow(rowChanges[index].Row);
                if (validate == false) { return false; }
            } 
            
            return true;
        }
        catch (ex) { ShowJSException(ex); }                       
    }
    
    var _fieldToFocus = null;
    function ValidateInuringRow(row)
    {
        try
        {
            // Do not validate FilterRow or Deleted rows
            if (row == null) { return true; }                         
            if (row == null || WebGrid_IsCurrentRowFilterRow("<%=this.grdInurings.ClientID%>") == true) { return true; }
            if (row.GetRowState() == "Deleted") { return true; }
            
            // Treaty Name
            var msg = new Array();
            var fieldFocus = null;
            var cells = row.GetCells();
            var treatyNameText = "";
            var treatyName = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>");
            if (treatyName != null && IsNullOrEmpty(treatyName.Value) == true) 
            {
                msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_TREATYNAME_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = treatyName; }
            }
            else { treatyNameText = treatyName.Value; }                                                           
                        
            // Effective Date
            var effectiveDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EFFECTIVEDATE%>");
            if (effectiveDate != null && IsNullOrEmpty(effectiveDate.Value) == true) 
            {
                msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EFFECTIVEDATE_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = effectiveDate; }
            }  
                        
            // Expiration Date
            var expirationDate = cells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_EXPIRATIONDATE%>");
            if (expirationDate != null && IsNullOrEmpty(expirationDate.Value) == true) 
            {
                msg.push("<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_EXPIRATIONDATE_REQUIRED%>");
                if (_fieldToFocus == null) { _fieldToFocus = expirationDate; }                
            }  
            
            // Display validation message
            // NOTE: Add Treaty Name to caption if specified
            if (msg != null && msg.length > 0)
            {
                // Display
                // NOTE: Select row after display       
                var caption = "<%=Endurance.Re.AWB.Web.AWBWebControls.General.Inurings.MESSAGE_VALIDATION_FAILED%>";
                if (IsNullOrEmpty(treatyNameText) == false) { caption += " - Treaty " + treatyNameText; }
                ShowWebDialog(caption, Array_GetList(msg, "<%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%>"), "OK", ShowWebDialog_OnClick)                
                return false;
            }
            return true;
        }
        catch (ex) { ShowJSException(ex); }             
    }
    
    function ShowWebDialog_OnClick()
    {
        // Select row
        // NOTE: This is done after the WebDialog is displayed to ensure row focus is not lost
        if (_fieldToFocus == null) { return; }
        WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", _fieldToFocus.Row, _fieldToFocus.Name);
        _fieldToFocus = null;        
    }
    
    function grdInurings_OnRowSelect(controlID, tblName, rowIndex, rowElement)
    {
        // Display Portfolio Name List            
        try { ShowPortfolioNameList(); }
        catch (ex) { ShowJSException(ex); }
    }
    
    function ShowPortfolioNameList()
    {
        try
        {         
            // Do not show data for FilterRow
            if (WebGrid_IsCurrentRowFilterRow("<%=this.grdInurings.ClientID%>") == true) 
            { 
                ShowPortfolioNameListCallOut(false);
                return false; 
            }
   
            // Display treaty's name and portfolio list
            // Title
            var wcoPortfolioNameList = GetPortfolioNameListCallOut();
            if (wcoPortfolioNameList == null) { return; }                     
            var titlePrefix = "Treaty";
            var treatyName = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_TREATYNAME%>");
            var title = (IsNullOrEmpty(treatyName) == false) ? titlePrefix + " " + treatyName : titlePrefix;
            wcoPortfolioNameList.SetTitle(title);
            
            // Portfolio Text
            var textPrefix = "Portfolios:";
            var portfolioNameList = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%>");
            var text = (IsNullOrEmpty(portfolioNameList) == false) ? textPrefix + " " + portfolioNameList : textPrefix + " None";
            wcoPortfolioNameList.SetText(text);
            wcoPortfolioNameList.Show();
        }
        catch (ex) { ShowJSException(ex); }
    }       
    
    function GetPortfolioNameListCallOut()
    {
        // Get PortfolioNameList's CallOut
        try { return ISGetObject("<%=this.wcoPortfolioNameList.ClientID%>"); }
        catch (ex) { ShowJSException(ex); }
    }
    
    function ShowPortfolioNameListCallOut(show)
    {        
        try 
        {  
            // Show/Hide
            var wcoPortfolioNameList = GetPortfolioNameListCallOut();
            if (wcoPortfolioNameList == null) { return; }
            if (show == null) { wcoPortfolioNameList.Show(); } else { wcoPortfolioNameList.Hide(); }
        }
        catch (ex) { ShowJSException(ex); }
    }
    
    //=================================================================
    // Function     : grdInurings_OnRowContextMenu
    // Description  : This method will create Context menu based on the
    //              : row.
    //=================================================================
    function grdInurings_OnRowContextMenu(controlId, rowType, rowElement, menuObject)
    {
        try
        {
            // Do not display ContextMenu for FilterRow/ReadOnly rows
            if (WebGrid_IsFilterRow(rowType) == true) { return false; }
            var isReadOnly = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.SP_COL_INURING_GET_ISREADONLY%>");
            if (isReadOnly.toLowerCase() == "true") { return false; }        

            // Hide default menu items
            WebGrid_ShowContextMenuItems(menuObject, false);                                  
            
            // Manage Portfolios
            var managePortfolios = new WebMenuItem();
            managePortfolios.ImageURL = "..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_EDIT_PATH%>";
            managePortfolios.Text = "Manage Portfolios";
            managePortfolios.Name = "itmManagePortfolios";
            managePortfolios.OnClick = "UpdatePortfolioList";
            menuObject.Items.Add(managePortfolios);
            
            // Delete Treaty
            var deleteTreaty = new WebMenuItem();
            deleteTreaty.ImageURL = "..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%>";
            deleteTreaty.Text = "Delete Treaty";
            deleteTreaty.Name = "itmDeleteTreaty";
            deleteTreaty.OnClick = "DeleteSelectedInuringRow";
            menuObject.Items.Add(deleteTreaty);           
        }
        catch (ex) { ShowJSException(ex); }
    }
    
    var _rowToUpdate = null;
    function UpdatePortfolioList()
    {
        try 
        {
            // Persist row to update
            _rowToUpdate = WebGrid_GetSelectedRow("<%=this.grdInurings.ClientID%>");
            
            // Get currently selected portfolios 
            var selectedPortfolioIDList = WebGrid_GetSelectedRowFieldText("<%=this.grdInurings.ClientID%>", "<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>");;
            
            // Load PortfolioPicker to manage portfolios
            var url = "<%=this.Page.ResolveUrl("~/" + Endurance.Re.AWB.Utility.AWBConstants.PAGE_PORTFOLIOPICKER_PATH)%>";
            url += "?<%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_PAGE%>=<%=Endurance.Re.Common.Data.CommonConstants.QUERYSTRING_MASTER_SHELL_MENU_TOOLBAR%>";
            url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_LOADTYPE%>=<%=Convert.ToInt32(Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.LoadTypes.EDMSnapShotPortfolio)%>";
            url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_RETURN_JSFUNCTION_SELPORTFOLIOS%>=UpdateSelectedRowPortfolios";
            url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_SELPORTFOLIOS%>=" + selectedPortfolioIDList;
            url += "&<%=Endurance.Re.AWB.Web.AWBWebControls.General.PortfolioPicker.QUERYSTRING_ANALYSISSCENARIO_ID%>=<%=base.Page.CurrentAnalysisScenarioID%>";
            OpenWindowUnlocked(url, "PortfolioPicker" + "<%=DateTime.Now.Millisecond%>", 1, 610, 415, 10, 10);
        }
        catch (ex) { ShowJSException(ex); }
    }
        
    function UpdateSelectedRowPortfolios(selectedPortfolioList)
    {
        try
        {
            if (_rowToUpdate == null) { return; }
            
            // Get grid
            var grdInurings = ISGetObject("<%=this.grdInurings.ClientID%>");
            if (grdInurings == null) { return false; }
                        
            // Indicate edit is occurring
            grdInurings.ClearSelection(); 
            _rowToUpdate.Select();
            _rowToUpdate.BeginEdit();
        
            UpdatePortfolioData(_rowToUpdate, selectedPortfolioList);
        
            // Indicate row's data has been changed and set row stats to edit            
            _rowToUpdate.Update();
            _rowToUpdate.SetDataChanged(); 
            _rowToUpdate.AddPendingChanges();
            grdInurings.MarkEdit(); 
            
            // Focus row
            WebGrid_SelectRow("<%=this.grdInurings.ClientID%>", _rowToUpdate);
            _rowToUpdate = null;            
            
            // Show updated portfolio name list
            ShowPortfolioNameList();
            
            return true;
        }
        catch (ex) { ShowJSException(ex); }
    }
    
    function UpdatePortfolioData(row, selectedPortfolioList)
    {
        try
        {
            // Update portfolio name list
            if (row == null) { return false; }
            var rowCells = row.GetCells();
            if (rowCells == null) { return; }
            var portfolioNameList = rowCells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIONAMELIST%>");
            if (portfolioNameList != null) 
            {                 
                var portfolioNameListText = (selectedPortfolioList != null) ? selectedPortfolioList.toStringValues() : "";
                WebGrid_SetFieldText(portfolioNameList, portfolioNameListText);
            } 
            
            // Update portfolio ID list        
            // NOTE: Convert Hashtable to delimited NameValueObject string
            var portfolioIDList = rowCells.GetNamedItem("<%=Endurance.Re.AWB.Utility.AWBConstants.FIELD_INURING_PORTFOLIOIDLIST%>");
            if (portfolioIDList != null) 
            {                 
                WebGrid_SetFieldText(portfolioIDList, NameValueObject_GetString(selectedPortfolioList));
            } 
                        
            return true;
        }
        catch (ex) { ShowJSException(ex); }            
    }  
    
    function DeleteSelectedInuringRow()
    {
        try 
        { 
            // Delete Treaty
            WebGrid_DeleteSelectedRow("<%=this.grdInurings.ClientID%>"); 
            
            // Hide PortfolioNameList CallOut
            ShowPortfolioNameListCallOut(false);
        }
        catch (ex) { ShowJSException(ex); }
    }   
                
// -->
</script>

<ISWebDesktop:WebPaneManager runat="server" ID="wpmPage" Height="100%" Width="100%"
    ImagesDirectory="~/Images/WebPaneManager/">
    <RootGroupPane Name="RootGroup">
        <Panes>
            <ISWebDesktop:WebPane Name="ToolBarShell" HeaderVisible="No" Height="Custom" HeightValue="32px"
                AllowCollapse="No" AllowResize="No" ContentScrollable="false">
                <ContentTemplate>
                    <table cellpadding="0" cellspacing="0" class="ContentTemplateTopSelectionRegion">
                        <tr>
                            <td>
                                <ISWebDesktop:WebToolBar runat="server" ID="wtbPageToolbar" Caption="" IntegratedTo="None"
                                    NewDockingArea="NotSet" NewDockingRow="0" Width="100%" AllowFloat="No" IsFloat="No"
                                    AllowCustomize="No" AllowDockBottom="No" AllowDockLeft="No" AllowDockRight="No"
                                    AllowDockTop="No" AllowExpandCollapse="No" AllowMove="No" HandleVisible="No"
                                    Height="24px" CommandMargin="2" DockingOffset="0" CommandSize="" HeaderHeight=""
                                    MergeToolBarParentID="">
                                    <Commands>
                                        <ISWebDesktop:ToolCommand Category="FileMenu" Name="cmdCreateInuring" Text="Create Inuring"
                                            AutoPostBack="No" DisplayMode="TextAndImage" Image="~/Images/16x16/wg5_newrow.gif"
                                            ToolTip="Create New Inuring">
                                        </ISWebDesktop:ToolCommand>
                                    </Commands>
                                    <CommandClientSideEvents OnClick="wtbPageToolbar_OnClick" />
                                    <SeparatorStyle CssClass="WebToolBarSeparatorStyle" />
                                    <MenuStyleSettings MenuAnimation="True">
                                    </MenuStyleSettings>
                                    <ToggleGroups>
                                        <ISWebDesktop:ToggleGroup Name="Browse" />
                                    </ToggleGroups>
                                    <BodyStyle BackColor="#BFDBFF" />
                                    <CommandStyle>
                                        <Normal CssClass="WebToolBarCommandStyleNormal">
                                        </Normal>
                                        <Over CssClass="WebToolBarCommandStyleOver">
                                        </Over>
                                        <Active CssClass="WebToolBarCommandStyleActive">
                                        </Active>
                                    </CommandStyle>
                                    <CommandDisabledStyle CssClass="WebToolBarCommandStyleDisabled">
                                    </CommandDisabledStyle>
                                </ISWebDesktop:WebToolBar>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ISWebDesktop:WebPane>
            <ISWebDesktop:WebGroupPane GroupType="VerticalTile" Name="GroupPaneShell">
                <Panes>
                    <ISWebDesktop:WebPane Name="ContentShell" Text="Inurings" AllowResize="Yes" ContentMode="UseInlineContent"
                        DiscardContainerStyle="True" ContentScrollable="False" HeaderVisible="No" Height="Custom"
                        HeightValue="100%" Width="Custom" WidthValue="100%">
                        <ContentTemplate>
                            <div class="ContentTemplateGridContent">
                                <CommonCtrl:EnduranceWebGrid runat="server" ID="grdInurings" DefaultStyleMode="Elegant"
                                    UseDefaultStyle="True" Width="100%" Height="100%" ViewStateItems="All" OnInitializeDataSource="grdInurings_OnInitializeDataSource"
                                    OnInitializePostBack="grdInurings_OnInitializePostBack" OnPrepareDataBinding="grdInurings_OnPrepareDataBinding"
                                    OnInitializeLayout="grdInurings_OnInitializeLayout" OnInitializeRow="grdInurings_OnInitializeRow"
                                    OnUpdateRow="grdInurings_OnUpdateRow" OnExport="grdInurings_OnExport">
                                    <LayoutSettings AutoHeight="false" AutoWidth="false" AllowBatchUpdate="true" BatchUpdateSettings-PromptUnsavedChanges="false"
                                        BatchUpdateSettings-AutomaticObjectUpdate="false" AllowEdit="Yes" EditOnClick="True"
                                        AllowAddNew="Yes" AllowDelete="Yes" PromptBeforeDelete="true" NewRowLostFocusAction="AlwaysPrompt"
                                        ResetNewRowValuesOnError="True" RowHeightDefault="22px" AllowFilter="Yes" AllowSelectColumns="Yes"
                                        AllowSorting="Yes" HideColumnsWhenGrouped="Default" AllowExport="Yes" InProgressUIBehavior="ChangeCursorToHourGlass"
                                        ApplyFiltersKey="Enter" AllowColumnFreezing="Yes" ShowFilterStatus="True" PagingMode="VirtualLoad"
                                        VerboseEditingInformation="False" FilterBarVisible="True" PagingExportMode="ExportAllData"
                                        CellPaddingDefault="0" AlwaysShowHelpButton="False" VirtualPageSize="200">
                                        <ClientSideEvents OnInitialize="grdInurings_OnInitialize" OnRowContextMenu="grdInurings_OnRowContextMenu"
                                            OnRowValidate="grdInurings_OnRowValidate" OnRowSelect="grdInurings_OnRowSelect" />
                                        <FrameStyle>
                                            <BorderSettings>
                                                <Top Style="none" />
                                                <Bottom Style="none" />
                                                <Left Color="#6593cf" Width="1" Style="solid" />
                                                <Right Color="#6593cf" Width="1" Style="solid" />
                                            </BorderSettings>
                                        </FrameStyle>
                                        <HeaderStyle CssClass="WebGridHeaderStyle" />
                                        <StatusBarStyle CssClass="WebGridStatusBarStyle" />
                                        <StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" Normal-CssClass="WebGridStatusBarCommandStyleNormal"
                                            Over-CssClass="WebGridStatusBarCommandStyleOver">
                                            <Normal CssClass="WebGridStatusBarCommandStyleNormal">
                                            </Normal>
                                            <Over CssClass="WebGridStatusBarCommandStyleOver">
                                            </Over>
                                            <Active CssClass="WebGridStatusBarCommandStyleActive">
                                            </Active>
                                        </StatusBarCommandStyle>
                                        <FilterRowStyle CssClass="WebGridFilterRowStyle" />
                                        <PreviewRowStyle CssClass="WebGridRowStyle" />
                                        <RowStyle CssClass="WebGridRowStyle" />
                                        <QuickFilterBarStyle CssClass="WebGridRowStyle" />
                                        <RowHeaderStyle CssClass="WebGridRowHeaderStyle" />
                                        <SelectedRowStyle CssClass="WebGridSelectedRowStyle" />
                                        <EditFocusCellStyle CssClass="WebGridRowStyle" />
                                        <FocusCellStyle CssClass="WebGridRowStyle" />
                                        <LostFocusRowStyle CssClass="WebGridRowStyle" />
                                        <NewRowStyle CssClass="WebGridRowStyle" />
                                        <SortedColumnStyle CssClass="WebGridSortedColumnStyle" />
                                        <AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" />
                                        <EditTextboxStyle CssClass="WebGridEditTextboxStyle" />
                                        <FreezePaneSettings ActiveFrozenColumns="4" ShowInContextMenu="False" ShowSplitterLine="False"
                                            MaxFrozenColumns="4" SplitterLineColor="ActiveBorder" SplitterLineWidth="1" />
                                    </LayoutSettings>
                                    <RootTable Caption="Inurings" DataKeyField="ID" NewRowInfoText="Please click here to create a new Inuring">
                                        <Columns>
                                            <ISWebGrid:WebGridColumn Caption="ID" Name="ID" DataMember="ID" DataType="System.Integer"
                                                ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit"
                                                Width="0px" Visible="false">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="IsReadOnly" Name="IsReadOnly" DataMember="IsReadOnly"
                                                DataType="System.Boolean" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="NoEdit" Width="0px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Select" Name="IsSelected" DataMember="IsSelected"
                                                DataType="System.Boolean" ColumnType="CheckBox" EditType="Checkbox" NewRowEditType="Checkbox"
                                                FilterEditType="Checkbox" Width="40px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Treaty Name" Name="TreatyName" DataMember="TreatyName"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="150px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Portfolio Name" Name="PortfolioNameList" DataMember="PortfolioNameList"
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="PortfolioIDList" Name="PortfolioIDList" DataMember="PortfolioIDList"
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="NoEdit" Width="0px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Cedant" Name="CedantName" DataMember="CedantName"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Inuring Structure" Name="InuringTypeID" DataMember="InuringTypeID"
                                                DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Currency" Name="CurrencyCode" DataMember="CurrencyCode"
                                                DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="70px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Occurrence Limit" Name="OccurrenceLimit" DataMember="OccurrenceLimit"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Attachment" Name="Attachment" DataMember="Attachment"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Risk Limit" Name="RiskLimit" DataMember="RiskLimit"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Retention" Name="Retention" DataMember="Retention"
                                                DataType="System.Integer" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="%Placed" Name="Placed" DataMember="Placed" DataType="System.Decimal"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="%Covered" Name="Covered" DataMember="Covered" DataType="System.Decimal"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Effective Date" Name="EffectiveDate" DataMember="EffectiveDate"
                                                DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo"
                                                NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Expiry Date" Name="ExpirationDate" DataMember="ExpirationDate"
                                                DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo"
                                                NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Premium" Name="Premium" DataMember="Premium" DataType="System.Integer"
                                                ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox"
                                                Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Coverage Basis" Name="CoverageBasisTypeID" DataMember="CoverageBasisTypeID"
                                                DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList"
                                                FilterEditType="DropdownList" Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Attachment Basis" Name="AttachmentBasisTypeID"
                                                DataMember="AttachmentBasisTypeID" DataType="System.Integer" ColumnType="Custom"
                                                EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList"
                                                Width="100px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Priority" Name="Priority" DataMember="Priority"
                                                DataType="System.DateTime" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="50px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Number of Reinstatements" Name="NumReinstatements"
                                                DataMember="NumReinstatements" DataType="System.DateTime" ColumnType="Text" EditType="TextBox"
                                                NewRowEditType="TextBox" FilterEditType="TextBox" Width="150px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Reinstatement Charge" Name="ReinstatementCharge"
                                                DataMember="ReinstatementCharge" DataType="System.DateTime" ColumnType="Text"
                                                EditType="TextBox" NewRowEditType="TextBox" FilterEditType="TextBox" Width="125px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Source" Name="Source" DataMember="Source" DataType="System.String"
                                                ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="TextBox"
                                                Width="50px">
                                            </ISWebGrid:WebGridColumn>
                                            <ISWebGrid:WebGridColumn Caption="Notes" Name="InuringNotes" DataMember="InuringNotes"
                                                DataType="System.String" ColumnType="Text" EditType="TextBox" NewRowEditType="TextBox"
                                                FilterEditType="TextBox" Width="300px">
                                            </ISWebGrid:WebGridColumn>
                                        </Columns>
                                    </RootTable>
                                </CommonCtrl:EnduranceWebGrid>
                            </div>
                        </ContentTemplate>
                    </ISWebDesktop:WebPane>
                </Panes>
            </ISWebDesktop:WebGroupPane>
        </Panes>
    </RootGroupPane>
    <SplitterStyle>
        <Normal CssClass="WebPaneManagerSplitterStyleNormal">
        </Normal>
        <Over CssClass="WebPaneManagerSplitterStyleOver" BaseStyle="Normal">
        </Over>
        <Active CssClass="WebPaneManagerSplitterStyleActive" BaseStyle="Normal">
        </Active>
    </SplitterStyle>
    <PaneSettings PaneSpacing="0">
        <ContainerStyle CssClass="WebPaneManagerContainerStyle">
        </ContainerStyle>
        <HeaderMainStyle CssClass="WebPaneManagerHeaderMainStyle">
        </HeaderMainStyle>
        <HeaderSubStyle CssClass="WebPaneManagerHeaderSubStyle">
        </HeaderSubStyle>
        <InfoTextStyle CssClass="WebPaneManagerHeaderInfoTextStyle">
        </InfoTextStyle>
    </PaneSettings>
    <FrameStyle CssClass="WebPaneManagerFrameStyle">
    </FrameStyle>
</ISWebDesktop:WebPaneManager>
<ISWebDesktop:WebCallOut runat="server" ID="wcoPortfolioNameList" Height="100%" Width="100%"
                         Title="Treaty" Text="" OffsetBottomPointingPosition="-12" OffsetTopPointingPosition="12"
                         EnableInteractiveMoving="true" ShowBehavior="NoFading" CloseBehavior="MouseOut"
                         LayoutMode="Simple" PointingPosition="AutoDetect" />

 

Posted: September 22, 2010 9:58 AM

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


 

This works for me but I had to remove the Row's AddPendingChanges() method which in another post was said to be called.


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.

After observing the function that you use to add the new row, there are two points that I notice. The first one is that you are using BatchUpdate feature on your WebGrid. And the last one is that AddPendingChanges() method is invoked to add the new row from the button click event.

I made a simple test on a WebGrid with BatchUpdate enabled. On the OnRowValidate client-side event of the Grid, I simply put an alert that I use to check whether the OnRowValidate client-side event is fired or not. The test will be made in two scenarios: manually add new row and programmatically add new row by clicking a button (client-side event).

When a new row manually added –this means that I go to the new row and type some value on the cells of the new row; after done, simply press Shift + Enter or Tab on the end of the new row to add the new row–, the OnRowValidate is fired.

When a new row is added by a button click (client-side event) –get the new row object, uses SetText() method on the fields of the new row, and uses AddPendingChanges() to add the new row–, the OnRowValidate is not fired.

It seems that when AddPendingChanges() method is invoked, WebGrid will consider that the user has sure that the changes is valid and directly add the changes to the grid. For this kind of scenario, I’d like to suggest you to add the validation function before invoking the AddPendingChanges() method. If the changes are valid, then the changes will be add to the grid (by invoking AddPendingChanges() method). Else if the changes are invalid, then cancel the changes.

Please let us know your response.


The purpose of the button is to create a new row with the user and default some data. Not all data is defaulted. The user is required to fill in the required fields which is why I am using the OnRowValidate event to ensure the row's data is entered properly.  Canceling the changes is not an option as the user has not had the opportunity to complete the row's data.

 

 

Posted: September 21, 2010 10:27 AM

Hi Shawn,

I have attach a video and a sample of mine using a few method of your code.

As you see in the video, I have define a templated cell with an image inside. By the time I click on the Add new 10 rows button, the new rows will be automatically add without an image on templated cell yet. But the image on templated cell will be show by the time you accept all changes.

It is already templated cell behaviour that it will not show what inside the templated cell when the changes haven't apply yet.

Please kindly inform  me if this is the right scenario as you wanted? If not, please kindly change what inside my code since we are using a different database when run it.

Hope this can solve your issue.

 

Best regards,

Niven Prasetya

 

The AVI won't play for me. Is it corrupted? I tried various players.

I don't see any changes in the code but it sounds like the template controls won't be available until the data is accepted.  This is a bug to me.  Other controls are rendered properly when a NewRow is created but not the CellTemplate? I don't understand why.

Posted: September 21, 2010 10:16 AM

Hi Shawn,

Ok, I will describe the code that I sent earlier to Michael. 

First, grid will set the ID column manually to (AUTO), means that the ID is generated automatically from database, for example if the ID is auto increment or GUID.

For this, you need to inform grid by using the following code:


cells.GetNamedItem("ProductID").SetChanges("false");


After that, when you add pending changes, the grid will set the field to AUTO and you can add as many row that you want to add without getting the error.

Have you tried to use the code? If not, please try to use the code and let me know if it's not working. Because I have test and some customers have used it without any problem.

Regards,

Gordon Tumewu

 

 

I still get errors.

 

Click "Add 10 new rows".

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BatchUpdateDeleteRow.aspx.cs" Inherits="BatchUpdateDeleteRow" %>
<%@ Register TagPrefix="iswebgrid" Namespace="ISNet.WebUI.WebGrid" Assembly="ISNet.WebUI.WebGrid" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD runat=server>
		<title>BatchUpdateDeleteRow</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<script language="javascript">
		    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() + 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 < numOfNewRows; index++)
		        {
		            var newRow = AddNewRow();
		            if (index < 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() + now.getMilliseconds())));
		            window.alert("customerID.SetChanges('false');");
		            customerID.SetChanges("false"); 
		        }	
		        
		        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); }
		    }

		    function WebGrid_UpdateSelectedRow()
		    {
		        try 
		        {
		            var grdInurings = ISGetObject("WebGrid1");
		             var updateRow = WebGrid_GetSelectedRow();
		            var cells = updateRow.GetCells();
		            var now = new Date()
		            // Get grid
		            

		            // Indicate edit is occurring
		            grdInurings.ClearSelection();
		            updateRow.Select();
		            updateRow.BeginEdit();
		            
		            WebGrid_SetFieldText(cells.GetNamedItem("PortfolioNameList"), String("Hello World" + (now.getSeconds() + now.getMilliseconds())));

		            // Indicate row's data has been changed and set row stats to edit
		            updateRow.Update();
		            updateRow.SetDataChanged();
		            updateRow.AddPendingChanges();
		            grdInurings.MarkEdit();		             
		        }
		        catch (ex) { ShowJSException(ex); }
		    }

		    //=================================================================
		    // Function     : grdInurings_OnRowContextMenu
		    // Description  : This method will create Context menu based on the
		    //              : row.
		    //=================================================================
		    function grdInurings_OnRowContextMenu(controlId, rowType, rowElement, menuObject) {
		        try {
		             
		            // Manage Portfolios
		            var managePortfolios = new WebMenuItem();
		              managePortfolios.Text = "Manage Portfolios";
		            managePortfolios.Name = "itmManagePortfolios";
		            managePortfolios.OnClick = "WebGrid_UpdateSelectedRow";
		            menuObject.Items.Add(managePortfolios);

		            
		        }
		        catch (ex) { ShowJSException(ex); }
		    }
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
		<input type="button" value="Update Selected Row" onclick="javascript:WebGrid_UpdateSelectedRow();" />
		<input type="button" value="New Row Causing More Data To Load" onclick="javascript:AddNewRowForceNewData();" />
		<input type="button" value="Add 5 new rows and delete 2" onclick="javascript:AddNewRows(5, 2);" />
		<input type="button" value="Delete Selected Row" onclick="javascript:WebGrid_DeleteSelectedRow();" />
		<input type="button" value="Add 10 new rows" onclick="javascript:AddNewRows(10);" />
		<asp:button runat="server" Text="Check WebRowChanges" OnClick="PerformInuringsGridBatchUpdate" />
			<iswebgrid:webgrid id=WebGrid1 runat="server" Height="279px" Width="896px" 
			DefaultStyleMode="Elegant"
                                    UseDefaultStyle="True"
			OnInitializeDataSource="WebGrid1_InitializeDataSource">
                    <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"          
        >
        <ClientSideEvents OnRowContextMenu="grdInurings_OnRowContextMenu" />
					<HeaderStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" ForeColor="Black" Height="20px"
						Font-Size="8pt" Font-Names="Verdana" BorderColor="#ACA899">
						<BorderSettings>
							<Left Color="White"></Left>
							<Top Color="White"></Top>
						</BorderSettings>
					</HeaderStyle>
					<FrameStyle BackColor="#F1EFE2"></FrameStyle>
					<GroupByBox>
						<LabelStyle BorderStyle="Solid" BorderWidth="1px" BackColor="White" Font-Size="8pt" Font-Names="Verdana"
							BorderColor="Navy"></LabelStyle>
						<Style BackColor="Gray">
						</Style>
					</GroupByBox>
					<EditTextboxStyle BorderStyle="None" BorderWidth="0px" Font-Size="8pt" Font-Names="Verdana"></EditTextboxStyle>
					<NewRowStyle BackColor="White" ForeColor="DarkGray" Font-Size="8pt" Font-Names="Verdana"></NewRowStyle>
					<FocusCellStyle BorderStyle="Solid" BorderWidth="1px" BorderColor="Navy"></FocusCellStyle>
					<RowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="White" Font-Size="8pt"
						Font-Names="Verdana"></RowStyle>
					<GroupRowInfoStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#F1EFE2" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="White">
						<BorderSettings>
							<Bottom Color="Silver"></Bottom>
							<Right Color="Silver"></Right>
						</BorderSettings>
					</GroupRowInfoStyle>
					<SelectedRowStyle BackColor="LightSteelBlue"></SelectedRowStyle>
					<AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="AntiqueWhite"
						Font-Size="8pt" Font-Names="Verdana"></AlternatingRowStyle>
					<StatusBarStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="#ACA899">
						<Padding Bottom="2px" Left="2px" Top="2px" Right="2px"></Padding>
					</StatusBarStyle>
					<StatusBarCommandStyle>
						<Over BorderWidth="1px" BorderColor="Navy" BorderStyle="Solid" BackColor="CornflowerBlue"></Over>
						<Normal>
							<Padding Bottom="1px" Left="1px" Top="1px" Right="1px"></Padding>
						</Normal>
						<Active BackColor="RoyalBlue" BaseStyle="Over"></Active>
					</StatusBarCommandStyle>
					<PreviewRowStyle ForeColor="#0000C0"></PreviewRowStyle>
				</LayoutSettings>
				<RootTable DataKeyField="CustomerID" Caption="Customers" GridLineStyle="NotSet">
					<Columns>
					        <ISWebGrid:WebGridColumn Caption="Portfolio Name" Name="PortfolioNameList"  
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Address" DataMember="Address" Name="Address" Width="100px"></iswebgrid:WebGridColumn>
						 
					 <ISWebGrid:WebGridColumn Caption=" " Name="AddPortfolio" DataMember=""
                        ButtonText="Add Portfolio" DataType="System.String" ColumnType="Template" EditType="NoEdit"
                        NewRowEditType="SameAsEditType" FilterEditType="NoEdit" Width="65px">
                        <ButtonStyle BackColor="AliceBlue">
                            <Padding Top="2px" Left="1px" Right="1px" Bottom="1px" />
                        </ButtonStyle>
                        <CellTemplate>
                            <img runat="server" id="imgPortfolio"  alt="Manage this treaty's portfolios"
                                border="0" style="padding-top: 1px;"  
                             />
                        </CellTemplate>
                    </ISWebGrid:WebGridColumn>
                    
                <iswebgrid:WebGridColumn Caption="City" DataMember="City" Name="City" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="ContactName" DataMember="ContactName" Name="ContactName" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="ContactTitle" DataMember="ContactTitle" Name="ContactTitle" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Country" DataMember="Country" Name="Country" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Fax" DataMember="Fax" Name="Fax" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="PostalCode" DataMember="PostalCode" Name="PostalCode" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Region" DataMember="Region" Name="Region" Width="100px"></iswebgrid:WebGridColumn>
					</Columns>
				</RootTable>
			</iswebgrid:webgrid>
			 
		</form>
	</body>
</HTML>

 

 

Based on the snippet you provided, you are using BatchUpdate feature and VirtualLoad paging. Under such scenario, you could set the Grid property HaltLoadMore set to true in order to abort the load more process once. In your case, you will need to set the property before invoking the Select or ActivateEdit method. Here is the snippet:

function AddRow()
{
var grid = ISGetObject("WebGrid1");
var newRow = grid.RootTable.NewRow(); // create new row object
var cells = newRow.GetCells(); // get WebGridCell collection

// populate new row object
.
.
.

// insert new record
newRow.AddPendingChanges();

grid.HaltLoadMore = true
newRow.GetCell(0).ActivateEdit();

}


 

Excellent. Thank you.
Posted: September 20, 2010 2:13 PM

Hi Shawn,


I can't replicate your issue, My CellTemplate WebGrid can show an image just fine.

Would you mind to send me your sample and let me try yours on my side?


Thank you.

Have a nice day.


Best regards,

Niven Prasetya


Please click the "Add 10 new rows" and notice the button is not displayed for any of the 10 rows.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BatchUpdateDeleteRow.aspx.cs" Inherits="BatchUpdateDeleteRow" %>
<%@ Register TagPrefix="iswebgrid" Namespace="ISNet.WebUI.WebGrid" Assembly="ISNet.WebUI.WebGrid" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD runat=server>
		<title>BatchUpdateDeleteRow</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<script language="javascript">
		    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() + 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 < numOfNewRows; index++)
		        {
		            var newRow = AddNewRow();
		            if (index < 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() + 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); }
		    }

		    function WebGrid_UpdateSelectedRow()
		    {
		        try 
		        {
		            var grdInurings = ISGetObject("WebGrid1");
		             var updateRow = WebGrid_GetSelectedRow();
		            var cells = updateRow.GetCells();
		            var now = new Date()
		            // Get grid
		            

		            // Indicate edit is occurring
		            grdInurings.ClearSelection();
		            updateRow.Select();
		            updateRow.BeginEdit();
		            
		            WebGrid_SetFieldText(cells.GetNamedItem("PortfolioNameList"), String("Hello World" + (now.getSeconds() + now.getMilliseconds())));

		            // Indicate row's data has been changed and set row stats to edit
		            updateRow.Update();
		            updateRow.SetDataChanged();
		            updateRow.AddPendingChanges();
		            grdInurings.MarkEdit();
		 
            
		        }
		        catch (ex) { ShowJSException(ex); }
		    }

		    //=================================================================
		    // Function     : grdInurings_OnRowContextMenu
		    // Description  : This method will create Context menu based on the
		    //              : row.
		    //=================================================================
		    function grdInurings_OnRowContextMenu(controlId, rowType, rowElement, menuObject) {
		        try {
		             
		            // Manage Portfolios
		            var managePortfolios = new WebMenuItem();
		              managePortfolios.Text = "Manage Portfolios";
		            managePortfolios.Name = "itmManagePortfolios";
		            managePortfolios.OnClick = "WebGrid_UpdateSelectedRow";
		            menuObject.Items.Add(managePortfolios);

		            
		        }
		        catch (ex) { ShowJSException(ex); }
		    }
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
		<input type="button" value="Update Selected Row" onclick="javascript:WebGrid_UpdateSelectedRow();" />
		<input type="button" value="New Row Causing More Data To Load" onclick="javascript:AddNewRowForceNewData();" />
		<input type="button" value="Add 5 new rows and delete 2" onclick="javascript:AddNewRows(5, 2);" />
		<input type="button" value="Delete Selected Row" onclick="javascript:WebGrid_DeleteSelectedRow();" />
		<input type="button" value="Add 10 new rows" onclick="javascript:AddNewRows(10);" />
		<asp:button runat="server" Text="Check WebRowChanges" OnClick="PerformInuringsGridBatchUpdate" />
			<iswebgrid:webgrid id=WebGrid1 runat="server" Height="279px" Width="896px" 
			DefaultStyleMode="Elegant"
                                    UseDefaultStyle="True"
			OnInitializeDataSource="WebGrid1_InitializeDataSource">
                    <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"          
        >
        <ClientSideEvents OnRowContextMenu="grdInurings_OnRowContextMenu" />
					<HeaderStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" ForeColor="Black" Height="20px"
						Font-Size="8pt" Font-Names="Verdana" BorderColor="#ACA899">
						<BorderSettings>
							<Left Color="White"></Left>
							<Top Color="White"></Top>
						</BorderSettings>
					</HeaderStyle>
					<FrameStyle BackColor="#F1EFE2"></FrameStyle>
					<GroupByBox>
						<LabelStyle BorderStyle="Solid" BorderWidth="1px" BackColor="White" Font-Size="8pt" Font-Names="Verdana"
							BorderColor="Navy"></LabelStyle>
						<Style BackColor="Gray">
						</Style>
					</GroupByBox>
					<EditTextboxStyle BorderStyle="None" BorderWidth="0px" Font-Size="8pt" Font-Names="Verdana"></EditTextboxStyle>
					<NewRowStyle BackColor="White" ForeColor="DarkGray" Font-Size="8pt" Font-Names="Verdana"></NewRowStyle>
					<FocusCellStyle BorderStyle="Solid" BorderWidth="1px" BorderColor="Navy"></FocusCellStyle>
					<RowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="White" Font-Size="8pt"
						Font-Names="Verdana"></RowStyle>
					<GroupRowInfoStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#F1EFE2" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="White">
						<BorderSettings>
							<Bottom Color="Silver"></Bottom>
							<Right Color="Silver"></Right>
						</BorderSettings>
					</GroupRowInfoStyle>
					<SelectedRowStyle BackColor="LightSteelBlue"></SelectedRowStyle>
					<AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="AntiqueWhite"
						Font-Size="8pt" Font-Names="Verdana"></AlternatingRowStyle>
					<StatusBarStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" Font-Size="8pt" Font-Names="Verdana"
						BorderColor="#ACA899">
						<Padding Bottom="2px" Left="2px" Top="2px" Right="2px"></Padding>
					</StatusBarStyle>
					<StatusBarCommandStyle>
						<Over BorderWidth="1px" BorderColor="Navy" BorderStyle="Solid" BackColor="CornflowerBlue"></Over>
						<Normal>
							<Padding Bottom="1px" Left="1px" Top="1px" Right="1px"></Padding>
						</Normal>
						<Active BackColor="RoyalBlue" BaseStyle="Over"></Active>
					</StatusBarCommandStyle>
					<PreviewRowStyle ForeColor="#0000C0"></PreviewRowStyle>
				</LayoutSettings>
				<RootTable DataKeyField="CustomerID" Caption="Customers" GridLineStyle="NotSet">
					<Columns>
					        <ISWebGrid:WebGridColumn Caption="Portfolio Name" Name="PortfolioNameList"  
                                                DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit"
                                                FilterEditType="TextBox" Width="100px">
                                            </ISWebGrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Address" DataMember="Address" Name="Address" Width="100px"></iswebgrid:WebGridColumn>
						 
					 <ISWebGrid:WebGridColumn Caption=" " Name="AddPortfolio" DataMember=""
                        ButtonText="Add Portfolio" DataType="System.String" ColumnType="Template" EditType="NoEdit"
                        NewRowEditType="SameAsEditType" FilterEditType="NoEdit" Width="65px">
                        <ButtonStyle BackColor="AliceBlue">
                            <Padding Top="2px" Left="1px" Right="1px" Bottom="1px" />
                        </ButtonStyle>
                        <CellTemplate>
                            <img runat="server" id="imgPortfolio"  alt="Manage this treaty's portfolios"
                                border="0" style="padding-top: 1px;"  
                             />
                        </CellTemplate>
                    </ISWebGrid:WebGridColumn>
                    
                <iswebgrid:WebGridColumn Caption="City" DataMember="City" Name="City" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="ContactName" DataMember="ContactName" Name="ContactName" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="ContactTitle" DataMember="ContactTitle" Name="ContactTitle" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Country" DataMember="Country" Name="Country" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Fax" DataMember="Fax" Name="Fax" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="PostalCode" DataMember="PostalCode" Name="PostalCode" Width="100px"></iswebgrid:WebGridColumn>
						<iswebgrid:WebGridColumn Caption="Region" DataMember="Region" Name="Region" Width="100px"></iswebgrid:WebGridColumn>
					</Columns>
				</RootTable>
			</iswebgrid:webgrid>
			 
		</form>
	</body>
</HTML>

 

 

All times are GMT -5. The time now is 10:49 AM.
Previous Next