Currently I have an application that is sitting on a tabstrip with pageviews that are actually usercontrols. On one of my usercontrols there is a grid with nestedviews. I have a need to when the tab changes to close all the rows in my grid. I have tried several ways of doing this and have not found a way. Any help would be appreciated.
I've tried the following.
I've tried the following.
rdInsLines.DataBind();
rdInsLines.ReBind();
foreach (GridItem item in rdInsLines.MasterTableView.Controls[0].Controls){
if (item is GridDataItem){
if (item.Expanded){
item.FireCommandEvent("ExpandCollapse", String.Empty);
}
item.FireCommandEvent("Validate", String.Empty);
}
}
foreach(GridDataItem item in RadGrid1.Items)
//loops through each grid item
{
item.Expanded = false;//collapse item
}
If you notice in the Page_Load Procedure some code that says
if (strControlName == "TabChanged")
{
if (!ValidateData())
{
if (Session["ErrorTab"] == null)
Session["ErrorTab"] = "Insurance";
}
rdInsLines.DataBind();
}
This is where I'm trying to close the grid but it's not working.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="InsuranceUC.ascx.cs"
Inherits="SterlingNational.Tax.WebApp.ActionPages.InsuranceUC" %>
<!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">
<script type="text/javascript">
function OnRowDblClick(sender, eventArgs) {
try {
var dataItem = $get(eventArgs.get_id());
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
var cell = MasterTable.getCellByColumnUniqueName(row, "LSS_INSURANCE_LINE_KEY");
var value = cell.innerHTML
__doPostBack('DoubleClick', value);
}
catch (e) {
_showAndLogException("STES.InsuranceUC.ascz.OnRowDblClick: " + e.message);
}
}
function keyPressed(sender, args) {
if (args.get_keyCode() == 13) {
var e = args.get_domEvent().rawEvent;
__doPostBack('SaveData');
e.returnValue = false;
e.cancelBubble = true;
if (e.stopPropagation) {
e.preventDefault();
e.stopPropagation();
}
}
}
</script>
<body>
<div>
<table>
<tr>
<td width="100%">
<asp:Label ID="Label20" runat="server" Text="Borrower Name:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small"></asp:Label>
<asp:Label ID="lblCustName3" runat="server" Text="" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label23" runat="server" Text="Create, edit, and confirm insurance lines for the escrowed insurance payments for this loan."
Font-Bold="True" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
</table>
<table width="800px">
<tr>
<td colspan="2">
<asp:Button ID="btnAddIns" runat="server" SkinID="Web20" Text="Add Insurance Line(s)"
Width="130px" ToolTip="Add insurance policy payment lines." OnClick="btnAddIns_onClick"
UseSubmitBehavior="false" />
<asp:Label ID="lblInsuranceError" runat="server" Text="" Font-Bold="True" Font-Size="10pt"
Font-Names="Arial" ForeColor="Red" Visible="false"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr style="height: 310px;">
<td>
</td>
<td align="left">
<div id="divInsGrid" style="display: none; width: 100%;" runat="server">
<telerik:RadGrid ID="rdInsLines" runat="server" AllowPaging="True" AllowSorting="True"
OnNeedDataSource="rdInsLines_NeedDataSource" AutoGenerateColumns="False" GridLines="Horizontal"
Height="300px" GroupingEnabled="False" OnItemCommand="rdInsLines_ItemCommand"
ShowGroupPanel="True" Skin="Web20">
<MasterTableView>
<NoRecordsTemplate>
No insurance data found.
</NoRecordsTemplate>
<NestedViewTemplate>
<asp:Panel runat="server" ID="InnerInsContainer" Visible="false" BorderColor="#2C57A2"
BorderStyle="Solid" BackColor="White" BorderWidth="1px">
<table>
<tr>
<td colspan="3">
<asp:Label ID="Label40" runat="server" Text="Type:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small"></asp:Label>
<telerik:RadComboBox ID="ddInsuranceTypes" runat="server" Skin="Web20" Width="200px"
AutoPostBack="True" OnSelectedIndexChanged="ddInsuranceTypes_SelectedIndexChanged"
TabIndex="1">
</telerik:RadComboBox>
</td>
<td colspan="2">
<asp:Label ID="Label18" runat="server" Text="Insurance Company" Font-Bold="True"
Font-Names="Arial" Font-Size="14px" Visible="false"></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="Label24" runat="server" Text="Policy Information" Font-Bold="True"
Font-Names="Arial" Font-Size="14px" Visible="false"></asp:Label>
</td>
<td align="right" style="width: 100px;">
<asp:Label ID="Label30" runat="server" Text="Name:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="txtInsCompany" Width="200px" MaxLength="100" runat="server"
Visible="false" TabIndex="9">
</telerik:RadTextBox>
</td>
<td style="width: 50px;">
<asp:Label ID="lblErrorCompany" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label19" runat="server" Text="Policy Number:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td style="width: 125px;">
<telerik:RadTextBox ID="txtPolicyNumber" Width="100px" MaxLength="50" runat="server"
Visible="false" TabIndex="2">
</telerik:RadTextBox>
</td>
<td>
</td>
<td align="right">
<asp:Label ID="Label25" runat="server" Text="Address:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="txtInsAddress" Width="200px" MaxLength="50" runat="server"
Visible="false" TabIndex="10">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label43" runat="server" Text="Monthly Amount:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
<asp:Label ID="Label44" runat="server" Text="Effective Date:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadNumericTextBox ID="txtMonthlyPremium" runat="server" Culture="English (United States)"
Skin="Web20" Type="Currency" Width="100px" Visible="false" TabIndex="3" MaxLength="8"
MinValue="0">
</telerik:RadNumericTextBox>
<telerik:RadDatePicker ID="rdEffectiveDate" runat="server" FocusedDate="" Skin="Web20"
Width="130px" Visible="false" TabIndex="4" DateInput-DateFormat="MM/dd/yyyy">
<Calendar ID="Calendar2" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
</Calendar>
<DateInput ID="DateInput2" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">
</DateInput>
</telerik:RadDatePicker>
</td>
<td>
<asp:Label ID="lblEffectiveDate" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
<td align="right">
<asp:Label ID="Label26" runat="server" Text="City:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="txtInsCity" Width="200px" MaxLength="100" runat="server"
Visible="false" TabIndex="11">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label49" runat="server" Text="First Due Date:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
<asp:Label ID="Label51" runat="server" Text="Expiration Date:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadDatePicker ID="rdPMIEffectiveDate" runat="server" FocusedDate="" Skin="Web20"
Width="130px" Visible="false" TabIndex="5" DateInput-DateFormat="MM/dd/yyyy">
<Calendar ID="Calendar3" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
</Calendar>
<DateInput ID="DateInput3" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">
</DateInput>
</telerik:RadDatePicker>
<telerik:RadDatePicker ID="rdExpirationDate" runat="server" FocusedDate="" Skin="Web20"
Width="130px" Visible="false" TabIndex="6" DateInput-DateFormat="MM/dd/yyyy">
<Calendar ID="Calendar5" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
</Calendar>
<DateInput ID="DateInput5" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">
</DateInput>
</telerik:RadDatePicker>
</td>
<td style="width: 115px;">
<asp:Label ID="lblErrorExpDate" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
<asp:Label ID="lblErrorExpDate2" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
<td align="right">
<asp:Label ID="Label29" runat="server" Text="State:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadComboBox ID="ddInsState" runat="server" Skin="Web20" Width="60px" Visible="false"
TabIndex="12">
</telerik:RadComboBox>
<asp:Label ID="Label31" runat="server" Text="ZIP:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
<telerik:RadMaskedTextBox ID="txtInsZip" runat="server" Width="90px" Mask="#####-####"
Skin="Web20" Visible="false" TabIndex="13" SelectionOnFocus="CaretToBeginning">
</telerik:RadMaskedTextBox>
</td>
<td>
<asp:Label ID="lblZipError" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblDueDate" runat="server" Text="Due Date:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadDatePicker ID="rdDueDate" runat="server" FocusedDate="" Skin="Web20"
Width="130px" Visible="false" TabIndex="5" DateInput-DateFormat="MM/dd/yyyy">
<Calendar ID="Calendar1" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
</Calendar>
<DateInput ID="DateInput1" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">
</DateInput>
</telerik:RadDatePicker>
</td>
<td>
</td>
<td align="right">
<asp:Label ID="Label32" runat="server" Text="Phone:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td colspan="2">
<telerik:RadMaskedTextBox ID="txtInsPhone" Width="100px" MaxLength="20" runat="server"
Mask="(###) ###-####" Skin="Web20" Visible="false" TabIndex="14" SelectionOnFocus="CaretToBeginning">
</telerik:RadMaskedTextBox>
<asp:Label ID="lblErrorPhone" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblStatus" runat="server" Text="Status:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadComboBox ID="cboStatus" runat="server" Skin="Web20" Width="105px"
AutoPostBack="True" TabIndex="1" Visible="false">
<Items>
<telerik:RadComboBoxItem runat="server" Text="Paid" />
<telerik:RadComboBoxItem runat="server" Text="UnPaid" />
</Items>
</telerik:RadComboBox>
</td>
<td>
</td>
<td align="right">
<asp:Label ID="Label33" runat="server" Text="Agency Name:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="txtAgencyName" Width="200px" MaxLength="100" runat="server"
Visible="false" TabIndex="15">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label39" runat="server" Text="Annual Premium:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadNumericTextBox ID="txtYearlyPremium" runat="server" Culture="English (United States)"
Skin="Web20" Type="Currency" Width="100px" Visible="false" TabIndex="7" MaxLength="8"
MinValue="0">
</telerik:RadNumericTextBox>
</td>
<td>
<asp:Label ID="lblErrorYearly" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
<td align="right">
<asp:Label ID="Label34" runat="server" Text="Agency Phone:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td colspan="2">
<telerik:RadMaskedTextBox ID="txtAgencyPhone" Width="100px" MaxLength="20" runat="server"
Mask="(###) ###-####" Skin="Web20" Visible="false" TabIndex="16" SelectionOnFocus="CaretToBeginning">
</telerik:RadMaskedTextBox>
<asp:Label ID="lblAgencyPhone" runat="server" Text="" Font-Bold="True" Font-Size="9pt"
Font-Names="Arial" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label42" runat="server" Text="Coverage Amount:" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" Visible="false"></asp:Label>
</td>
<td>
<telerik:RadNumericTextBox ID="txtCoverageAmount" runat="server" Culture="English (United States)"
Skin="Web20" Type="Currency" Width="100px" Visible="false" TabIndex="8" MaxValue="9999999999"
MinValue="0" MaxLength="8">
</telerik:RadNumericTextBox>
</td>
</tr>
</table>
</asp:Panel>
</NestedViewTemplate>
<Columns>
<telerik:GridBoundColumn DataField="INSURANCE_TYPE_MDESC" HeaderText="Type" UniqueName="INSURANCE_TYPE_MDESC"
EmptyDataText="">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="105px" />
<ItemStyle Width="105px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_NAME" HeaderText="Insurance Company"
UniqueName="INSURANCE_COMPANY_NAME" EmptyDataText="">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="190px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="YEARLY_PREMIUM" HeaderText="Premium" UniqueName="YEARLY_PREMIUM"
EmptyDataText="">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="70px" />
<ItemStyle HorizontalAlign="Right" Width="70px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EXPIRATION_DATE" HeaderText="Exp. Date" UniqueName="EXPIRATION_DATE"
EmptyDataText="">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="60px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="POLICY_NUMBER" HeaderText="Policy Number" UniqueName="POLICY_NUMBER"
EmptyDataText="">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="170px" />
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl='../Images/edit.GIF' CommandName="ExpandCollapse" UniqueName="InsEdit">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="35px" />
</telerik:GridButtonColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl='../Images/deleteX.GIF' CommandName="Delete" ConfirmText="Are you sure you want to delete this Insurance Line?">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="40px" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="LSS_INSURANCE_LINE_KEY" Display="False" UniqueName="LSS_INSURANCE_LINE_KEY"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LSS_INSURANCE_TYPE" Display="False" UniqueName="LSS_INSURANCE_TYPE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_STREET" Display="False" UniqueName="INSURANCE_COMPANY_STREET"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_CITY" Display="False" UniqueName="INSURANCE_COMPANY_CITY"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_STATE" Display="False" UniqueName="INSURANCE_COMPANY_STATE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_ZIP" Display="False" UniqueName="INSURANCE_COMPANY_ZIP"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INSURANCE_COMPANY_PHONE" Display="False" UniqueName="INSURANCE_COMPANY_PHONE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AGENCY_NAME" Display="False" UniqueName="AGENCY_NAME"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AGENCY_PHONE_NUMBER" Display="False" UniqueName="AGENCY_PHONE_NUMBER"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="COVERAGE_AMOUNT" Display="False" UniqueName="COVERAGE_AMOUNT"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PAYMENT_DUE_DATE" Display="False" UniqueName="PAYMENT_DUE_DATE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EFFECTIVE_DATE" Display="False" UniqueName="EFFECTIVE_DATE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PAYMENTS_PER_YEAR" Display="False" UniqueName="PAYMENTS_PER_YEAR"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LENDER_NUMBER" Display="False" UniqueName="LENDER_NUMBER"
MaxLength="100" EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LOAN_NUMBER" Display="False" UniqueName="LOAN_NUMBER"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DUE_DATE" Display="False" UniqueName="DUE_DATE"
EmptyDataText="">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PAID_IND" Display="False" UniqueName="PAID_IND"
EmptyDataText="">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<SelectedItemStyle BackColor="#F8C320" />
<ClientSettings EnableRowHoverStyle="true">
<ClientEvents OnRowDblClick="OnRowDblClick" />
<ClientEvents OnKeyPress="keyPressed" />
<Selecting AllowRowSelect="false" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" />
</ClientSettings>
</telerik:RadGrid>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using SterlingNational.OracleDataAccess; using Telerik.Web.UI; using SterlingNational.DomainLibrary; using System.Collections; using SterlingNational.Tax.WebApp.BasePages; namespace SterlingNational.Tax.WebApp.ActionPages { public partial class InsuranceUC : BaseUserControl { private TaxUserData taxUserData; private InsuranceData insuranceData; private LoanData loanData; public int errorCount = 0; protected void Page_Load(object sender, EventArgs e) { taxUserData = new TaxUserData(); BorrowerData borrowerData = new BorrowerData(); LoanData loanData = new LoanData(); if (taxUserData.UserID == null) { Response.Redirect(CONST.C_SESSION_EXPIRE_REDIRECT, true); } if (!Page.IsPostBack) { LoadData(); } else { string strControlName = ""; strControlName = Request.Params.Get("__EVENTTARGET"); if (strControlName == "TabChanged") { if (!ValidateData()) { if (Session["ErrorTab"] == null) Session["ErrorTab"] = "Insurance"; } rdInsLines.DataBind(); } if (strControlName == "DoubleClick") { foreach (GridItem item in rdInsLines.MasterTableView.Controls[0].Controls) { if (item is GridDataItem) { GridDataItem dataItem = (GridDataItem)item; if (dataItem["LSS_INSURANCE_LINE_KEY"].Text == Request.Params.Get("__EVENTARGUMENT")) { item.FireCommandEvent("ExpandCollapse", String.Empty); } } } } // Refresh the borrower name lblCustName3.Text = borrowerData.MortgagorLastName + ", " + borrowerData.MortgagorFirstName; } btnAddIns.Focus(); } internal override void SaveData() { try { StatementsData statementsData = new StatementsData(); // Shouldn't this field be in InsuranceData? insuranceData = new InsuranceData(); taxUserData = new TaxUserData(); // Save to the database if (insuranceData.InsuranceDataTable.Rows.Count > 0) { if (ValidateData()) { foreach (DataRow row in insuranceData.InsuranceDataTable.Rows) { // Don't save the deleted data if (row.RowState != DataRowState.Deleted) { Hashtable insuranceInfo = new Hashtable(); if (errorCount == 0) { insuranceInfo[DBEscrowServicing.LENDER_NUMBER] = row[DBEscrowServicing.LENDER_NUMBER]; insuranceInfo[DBEscrowServicing.LOAN_NUMBER] = row[DBEscrowServicing.LOAN_NUMBER]; insuranceInfo[DBEscrowServicing.LSS_INSURANCE_LINE_KEY] = row[DBEscrowServicing.LSS_INSURANCE_LINE_KEY]; insuranceInfo[DBEscrowServicing.LSS_INSURANCE_TYPE] = row[DBEscrowServicing.LSS_INSURANCE_TYPE]; insuranceInfo[DBEscrowServicing.INSURANCE_TYPE_MDESC] = row[DBEscrowServicing.INSURANCE_TYPE_MDESC]; insuranceInfo[DBEscrowServicing.POLICY_NUMBER] = row[DBEscrowServicing.POLICY_NUMBER]; insuranceInfo[DBEscrowServicing.PAYMENTS_PER_YEAR] = row[DBEscrowServicing.PAYMENTS_PER_YEAR]; insuranceInfo[DBEscrowServicing.EFFECTIVE_DATE] = row[DBEscrowServicing.EFFECTIVE_DATE]; insuranceInfo[DBEscrowServicing.EXPIRATION_DATE] = row[DBEscrowServicing.EXPIRATION_DATE]; insuranceInfo[DBEscrowServicing.COVERAGE_AMOUNT] = row[DBEscrowServicing.COVERAGE_AMOUNT]; insuranceInfo[DBEscrowServicing.YEARLY_PREMIUM] = row[DBEscrowServicing.YEARLY_PREMIUM]; insuranceInfo[DBEscrowServicing.AGENCY_NAME] = row[DBEscrowServicing.AGENCY_NAME]; insuranceInfo[DBEscrowServicing.AGENCY_PHONE_NUMBER] = row[DBEscrowServicing.AGENCY_PHONE_NUMBER]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_CITY] = row[DBEscrowServicing.INSURANCE_COMPANY_CITY]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_NAME] = row[DBEscrowServicing.INSURANCE_COMPANY_NAME]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_PHONE] = row[DBEscrowServicing.INSURANCE_COMPANY_PHONE]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_STATE] = row[DBEscrowServicing.INSURANCE_COMPANY_STATE]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_STREET] = row[DBEscrowServicing.INSURANCE_COMPANY_STREET]; insuranceInfo[DBEscrowServicing.INSURANCE_COMPANY_ZIP] = row[DBEscrowServicing.INSURANCE_COMPANY_ZIP]; insuranceInfo[DBEscrowServicing.DUE_DATE] = row[DBEscrowServicing.DUE_DATE]; insuranceInfo[DBEscrowServicing.PAID_IND] = row[DBEscrowServicing.PAID_IND]; insuranceInfo[DBEscrowServicing.LAST_CHANGE_EMPLOYEE_KEY] = taxUserData.EmployeeKey; insuranceInfo[DBEscrowServicing.CUSHION_MONTHS] = statementsData.InsuranceCushionMonths; // If this item does not exist, insert if (row[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].ToString() == "0") { int newLssLineKey = DBEscrowServicing.CreateInsuranceLine(insuranceInfo); // Update the session data ((DataTable)Session["InsGridSource"]).Rows.Find("0").SetField( DBEscrowServicing.LSS_INSURANCE_LINE_KEY, newLssLineKey.ToString()); Session["SavedCorrectly"] = "True"; } // Else update else { DBEscrowServicing.UpdateInsuranceLine(insuranceInfo); Session["SavedCorrectly"] = "True"; } } else { Session["SavedCorrectly"] = "False"; } } } LoadData(); } else { Session["SavedCorrectly"] = "False"; } } } catch (Exception ex) { throw new Exception( "Exception in SaveData " + ex.Message); } } internal override void LoadData() { BorrowerData borrowerData = new BorrowerData(); InsuranceData insuranceData = new InsuranceData(); lblCustName3.Text = borrowerData.MortgagorLastName + ", " + borrowerData.MortgagorFirstName; if (insuranceData.InsuranceDataTable.Rows.Count > 0) { rdInsLines.DataSource = insuranceData.InsuranceDataTable; rdInsLines.DataBind(); divInsGrid.Style["display"] = ""; } else { rdInsLines.DataSource = insuranceData.InsuranceDataTable; rdInsLines.DataBind(); divInsGrid.Style["display"] = "none"; } } protected void rdInsLines_ItemCommand(object source, GridCommandEventArgs e) { GridDataItem dataItem = e.Item as GridDataItem; loanData = new LoanData(); if (e.CommandName == RadGrid.ExpandCollapseCommandName) { ((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").Visible = !e.Item.Expanded; if (!e.Item.Expanded) { RadComboBox StateList = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsState"); StateList.DataSource = Session["StateList"]; StateList.DataTextField = "STATE_ABBREVIATION"; StateList.DataValueField = "STATE_ABBREVIATION"; StateList.DataBind(); RadComboBox InsuranceList = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); InsuranceList.DataSource = Session["InsuranceList"]; InsuranceList.DataTextField = "MDESC"; InsuranceList.DataValueField = "TYPE"; InsuranceList.DataBind(); RadComboBox InsuranceType = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); InsuranceType.SelectedValue = dataItem["LSS_INSURANCE_TYPE"].Text; if (dataItem["LSS_INSURANCE_LINE_KEY"].Text == "0") InsuranceType.Enabled = true; else InsuranceType.Enabled = false; LoadNestedView(dataItem["LSS_INSURANCE_TYPE"].Text, dataItem, e); RadTextBox PolicyNumber = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtPolicyNumber"); if (InsuranceType.Enabled == true) InsuranceType.Focus(); else PolicyNumber.Focus(); } else { RadComboBox InsuranceType = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); dataItem["LSS_INSURANCE_TYPE"].Text = InsuranceType.SelectedValue; RadComboBox InsuranceDesc = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); dataItem["INSURANCE_TYPE_MDESC"].Text = InsuranceDesc.Text; RadTextBox PolicyNumber = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtPolicyNumber"); dataItem["POLICY_NUMBER"].Text = PolicyNumber.Text; RadTextBox InsuranceCo = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCompany"); dataItem["INSURANCE_COMPANY_NAME"].Text = InsuranceCo.Text; RadDatePicker dtDueDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdDueDate"); dataItem["DUE_DATE"].Text = String.Format("{0:d}", dtDueDate.SelectedDate); RadComboBox Status = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("cboStatus"); dataItem["PAID_IND"].Text = Status.Text; if ((InsuranceType.SelectedValue != "998") && (InsuranceType.SelectedValue != "999")) { RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); dataItem["EFFECTIVE_DATE"].Text = String.Format("{0:d}", EffectiveDate.SelectedDate); dataItem[DBEscrowServicing.PAYMENTS_PER_YEAR].Text = "1"; RadDatePicker ExpDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); dataItem["EXPIRATION_DATE"].Text = String.Format("{0:d}", ExpDate.SelectedDate); RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); if (YearlyPremium.Text != "") { Decimal decimalVal = System.Convert.ToDecimal(YearlyPremium.Text); String payment = String.Format("{0:C}", decimalVal); dataItem["YEARLY_PREMIUM"].Text = payment; } else { dataItem["YEARLY_PREMIUM"].Text = ""; } } else { RadDatePicker PMIEffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); dataItem["EFFECTIVE_DATE"].Text = String.Format("{0:d}", PMIEffectiveDate.SelectedDate); if (PMIEffectiveDate.SelectedDate != null) { DateTime effDate = (DateTime)PMIEffectiveDate.SelectedDate; DateTime fpddDate = (DateTime)Convert.ToDateTime(loanData.FirstPaymentDueDate); if (effDate.Date < fpddDate.Date) effDate = fpddDate; TimeSpan diffDate = fpddDate.AddMonths(12).Subtract(effDate); int months = (diffDate.Days / 30); if (months <= 0) months = 12; dataItem[DBEscrowServicing.PAYMENTS_PER_YEAR].Text = months.ToString(); } else dataItem[DBEscrowServicing.PAYMENTS_PER_YEAR].Text = "0"; RadNumericTextBox MonthlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); if (MonthlyPremium.Text != "") { Decimal decimalVal = System.Convert.ToDecimal(MonthlyPremium.Text); String payment = String.Format("{0:C}", decimalVal); dataItem["YEARLY_PREMIUM"].Text = payment; } else { dataItem["YEARLY_PREMIUM"].Text = ""; } } RadTextBox InsuranceStreet = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsAddress"); dataItem["INSURANCE_COMPANY_STREET"].Text = InsuranceStreet.Text; RadTextBox InsuranceCity = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCity"); dataItem["INSURANCE_COMPANY_CITY"].Text = InsuranceCity.Text; RadComboBox InsuranceState = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsState"); dataItem["INSURANCE_COMPANY_STATE"].Text = InsuranceState.SelectedValue; RadNumericTextBox CoverageAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtCoverageAmount"); if (CoverageAmount.Text != "") { Decimal decimalVal1 = System.Convert.ToDecimal(CoverageAmount.Text); String payment1 = String.Format("{0:C}", decimalVal1); dataItem["COVERAGE_AMOUNT"].Text = payment1; } else { dataItem["COVERAGE_AMOUNT"].Text = ""; } RadMaskedTextBox InsuranceZip = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsZip"); dataItem["INSURANCE_COMPANY_ZIP"].Text = InsuranceZip.Text; RadMaskedTextBox InsurancePhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsPhone"); dataItem["INSURANCE_COMPANY_PHONE"].Text = InsurancePhone.Text; RadTextBox AgencyName = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyName"); dataItem["AGENCY_NAME"].Text = AgencyName.Text; RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); dataItem["AGENCY_PHONE_NUMBER"].Text = AgencyPhone.Text; } } if (e.CommandName == "Delete") { //DELETE Ins LINE if (dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text != "") { int insLineKey = Convert.ToInt32(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text); DBEscrowServicing.DeleteInsuranceLine(insLineKey, taxUserData.EmployeeKey); Session["SavedCorrectly"] = true; //insuranceData = new InsuranceData(); //insuranceData.InsuranceDataTable.Rows.Find(insLineKey).Delete(); Session["InsGridSource"] = DBEscrowServicing.GetInsLines(Session["CurrentLender"].ToString(), loanData.LoanNumber.ToString()); InsuranceData insuranceData = new InsuranceData(); // Update the Session data object //Session["InsGridSource"] = insuranceData.InsuranceDataTable; LoadData(); } } if (e.CommandName == "Custom") { RadComboBox StateList = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsState"); StateList.DataSource = Session["StateList"]; StateList.DataTextField = "STATE_ABBREVIATION"; StateList.DataValueField = "STATE_ABBREVIATION"; StateList.DataBind(); if (dataItem["LSS_INSURANCE_LINE_KEY"].Text == "0") { Label InsName = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label30"); InsName.Visible = true; Label InsAddress = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label25"); InsAddress.Visible = true; Label InsCity = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label26"); InsCity.Visible = true; Label InsState = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label29"); InsState.Visible = true; Label InsZip = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label31"); InsZip.Visible = true; Label InsPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label32"); InsPhone.Visible = true; Label InsCo = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label18"); InsCo.Visible = true; Label Policy = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label24"); Policy.Visible = true; Label PolicyNo = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label19"); PolicyNo.Visible = true; RadTextBox InsuranceCo = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCompany"); Label lblErrorCompany = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorCompany"); InsuranceCo.Visible = true; InsuranceCo.Text = ""; lblErrorCompany.Text = ""; RadTextBox InsuranceStreet = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsAddress"); InsuranceStreet.Visible = true; InsuranceStreet.Text = ""; RadTextBox InsuranceCity = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCity"); InsuranceCity.Visible = true; InsuranceCity.Text = ""; RadComboBox InsuranceState = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsState"); InsuranceState.Visible = true; InsuranceState.SelectedValue = ""; RadMaskedTextBox InsuranceZip = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsZip"); Label lblZipCode = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblZipError"); InsuranceZip.Visible = true; InsuranceZip.Text = ""; lblZipCode.Text = ""; RadMaskedTextBox InsurancePhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsPhone"); Label lblErrorPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorPhone"); InsurancePhone.Visible = true; InsurancePhone.Text = ""; lblErrorPhone.Text = ""; RadTextBox PolicyNumber = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtPolicyNumber"); PolicyNumber.Visible = true; PolicyNumber.Text = ""; Label lblErrorYearly = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorYearly"); lblErrorYearly.Text = ""; Label lblEffectiveDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblEffectiveDate"); lblEffectiveDate.Text = ""; Label lblErrorExpDate2 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorExpDate2"); lblErrorExpDate2.Text = ""; Label lblErrorExpDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorExpDate"); lblErrorExpDate.Text = ""; Label lblAgencyPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblAgencyPhone"); lblAgencyPhone.Text = ""; Label lblPMIEffectiveDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblEffectiveDate"); lblPMIEffectiveDate.Text = ""; RadDatePicker DueDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdDueDate"); DueDate.Visible = true; DueDate.SelectedDate = null; if ((dataItem["LSS_INSURANCE_TYPE"].Text != "998") && (dataItem["LSS_INSURANCE_TYPE"].Text != "999")) { Label Label33 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label33"); Label33.Visible = true; Label Label34 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label34"); Label34.Visible = true; Label Label44 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label44"); Label44.Visible = true; Label Label51 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label51"); Label51.Visible = true; Label Label39 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label39"); Label39.Visible = true; Label Label42 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label42"); Label42.Visible = true; RadTextBox AgencyName = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyName"); AgencyName.Visible = true; AgencyName.Text = ""; RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); AgencyPhone.Visible = true; AgencyPhone.Text = ""; RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); EffectiveDate.Visible = true; EffectiveDate.SelectedDate = null; RadDatePicker ExpirationDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); ExpirationDate.Visible = true; ExpirationDate.SelectedDate = null; RadNumericTextBox CoverageAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtCoverageAmount"); CoverageAmount.Visible = true; CoverageAmount.Text = ""; RadDatePicker ExpDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); ExpDate.Visible = true; ExpDate.SelectedDate = null; RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); YearlyPremium.Visible = true; YearlyPremium.Text = ""; Label MonAmount = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label43"); MonAmount.Visible = false; Label Label49 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label49"); Label49.Visible = false; RadNumericTextBox MonthlyAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); MonthlyAmount.Visible = false; RadDatePicker PMIEffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); PMIEffectiveDate.Visible = false; } else { Label Label33 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label33"); Label33.Visible = false; Label Label34 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label34"); Label34.Visible = false; Label Label44 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label44"); Label44.Visible = false; Label Label51 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label51"); Label51.Visible = false; Label Label39 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label39"); Label39.Visible = false; Label Label42 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label42"); Label42.Visible = false; RadTextBox AgencyName = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyName"); AgencyName.Visible = false; RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); AgencyPhone.Visible = false; RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); EffectiveDate.Visible = false; RadDatePicker ExpirationDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); ExpirationDate.Visible = false; RadNumericTextBox CoverageAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtCoverageAmount"); CoverageAmount.Visible = false; RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); YearlyPremium.Visible = false; Label MonAmount = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label43"); MonAmount.Visible = true; Label Label49 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label49"); Label49.Visible = true; RadNumericTextBox MonthlyAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); MonthlyAmount.Visible = true; MonthlyAmount.Text = ""; RadDatePicker PMIEffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); PMIEffectiveDate.Visible = true; PMIEffectiveDate.SelectedDate = null; } Session["LSS_INS_TYPE"] = dataItem["LSS_INSURANCE_TYPE"].Text; //LoadNestedView(dataItem["LSS_INSURANCE_TYPE"].Text, dataItem, e); RadComboBox InsuranceType = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); if (InsuranceType.Enabled == true) InsuranceType.Focus(); else PolicyNumber.Focus(); } } if (e.CommandName == "Validate") { int rowCount = 0; ((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").Visible = !e.Item.Expanded; LoadNestedView(dataItem["LSS_INSURANCE_TYPE"].Text, dataItem, e); //LinkButton button = dataItem["InsEdit"].Controls[0] as LinkButton; //button.Text = "Edit"; RadTextBox InsuranceCo = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCompany"); Label lblErrorCompany = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorCompany"); if (InsuranceCo.Text == "") { lblErrorCompany.Text = "*Required"; errorCount += 1; rowCount += 1; } else { lblErrorCompany.Text = ""; } RadMaskedTextBox InsPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsPhone"); Label lblErrorPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorPhone"); if (InsPhone.Text.Length > 0) { if (InsPhone.Text.Length < 10) { lblErrorPhone.Text = "*Must be ten digits"; errorCount += 1; rowCount += 1; } else { lblErrorPhone.Text = ""; } } else lblErrorPhone.Text = ""; RadMaskedTextBox ZipCode = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsZip"); Label lblZipCode = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblZipError"); if (ZipCode.Text.Length > 0) { if (ZipCode.Text.Length < 5) { lblZipCode.Text = "*Minimum 5 digits"; errorCount += 1; rowCount += 1; } else { //string zipCode = ZipCode.TextWithPrompt.Substring(0, 5).Replace("_", "").ToString(); //if (zipCode.Length < 5) //{ // lblZipCode.Text = "*Invalid Zip Code"; // errorCount += 1; // rowCount += 1; //} //else lblZipCode.Text = ""; } } else lblZipCode.Text = ""; RadComboBox InsuranceType = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes"); InsuranceType.SelectedValue = dataItem["LSS_INSURANCE_TYPE"].Text; if ((InsuranceType.SelectedValue != "998") && (InsuranceType.SelectedValue != "999")) { RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); Label lblErrorYearly = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorYearly"); if ((YearlyPremium.Text == "") || (YearlyPremium.Text == "0")) { lblErrorYearly.Text = "*Required"; errorCount += 1; rowCount += 1; } else { lblErrorYearly.Text = ""; } RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); Label lblEffectiveDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblEffectiveDate"); if (EffectiveDate.SelectedDate.ToString() == "") { lblEffectiveDate.Text = "*Required"; errorCount += 1; rowCount += 1; } else { DateTime now = DateTime.Now; if (Convert.ToDateTime(EffectiveDate.SelectedDate) < now.Date.AddYears(-1)) { lblEffectiveDate.Text = "Date cannot be more than one year in the past."; errorCount += 1; rowCount += 1; } else { lblEffectiveDate.Text = ""; } } RadDatePicker ExpirationDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); Label lblErrorExpDate2 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorExpDate2"); if (ExpirationDate.SelectedDate.ToString() == "") { lblErrorExpDate2.Text = "*Required"; errorCount += 1; rowCount += 1; } else { if (EffectiveDate.SelectedDate.ToString() != "") { if (Convert.ToDateTime(ExpirationDate.SelectedDate) > Convert.ToDateTime(EffectiveDate.SelectedDate).AddYears(+1)) { lblErrorExpDate2.Text = "Cannot be more than one year past the Effective Date."; errorCount += 1; rowCount += 1; } else { lblErrorExpDate2.Text = ""; } } else { lblErrorExpDate2.Text = ""; } } Label lblErrorExpDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorExpDate"); if ((ExpirationDate.SelectedDate.ToString() != "") && (EffectiveDate.SelectedDate.ToString() != "")) { if ((Convert.ToDateTime(EffectiveDate.SelectedDate) > Convert.ToDateTime(ExpirationDate.SelectedDate))) { lblErrorExpDate.Text = "Effective Date cannot be greater than Expiration Date."; errorCount += 1; rowCount += 1; } else { lblErrorExpDate.Text = ""; } } RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); Label lblAgencyPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblAgencyPhone"); if (AgencyPhone.Text.Length > 0) { if (AgencyPhone.Text.Length < 10) { lblAgencyPhone.Text = "*Must be ten digits."; errorCount += 1; rowCount += 1; } else { lblAgencyPhone.Text = ""; } } else lblAgencyPhone.Text = ""; } else { RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); Label lblPMIEffectiveDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblEffectiveDate"); if ((YearlyPremium.Text == "") || (YearlyPremium.Text == "0")) { lblPMIEffectiveDate.Text = "*Required"; errorCount += 1; rowCount += 1; } else { lblPMIEffectiveDate.Text = ""; } RadDatePicker PMIFPDD = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); Label lblErrorExpDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblErrorExpDate"); if (PMIFPDD.SelectedDate.ToString() == "") { lblErrorExpDate.Text = "*Required"; errorCount += 1; rowCount += 1; } else { lblErrorExpDate.Text = ""; } } if (rowCount != 0) dataItem.FireCommandEvent("ExpandCollapse", String.Empty); } } protected void btnAddIns_onClick(object sender, EventArgs e) { try { SaveData(); insuranceData = new InsuranceData(); if (Session["SavedCorrectly"].ToString() == "True") { divInsGrid.Style["display"] = ""; DataTable insList = insuranceData.InsuranceDataTable; //Add a new row DataRow newRow = insList.NewRow(); newRow[DBEscrowServicing.LENDER_NUMBER] = Session["CurrentLender"].ToString(); newRow[DBEscrowServicing.LOAN_NUMBER] = Session["LOAN_NUMBER"]; newRow[DBEscrowServicing.LSS_INSURANCE_TYPE] = "351"; Session["LSS_INS_TYPE"] = "351"; newRow[DBEscrowServicing.LSS_INSURANCE_LINE_KEY] = 0; insList.Rows.Add(newRow); rdInsLines.DataSource = insList; rdInsLines.DataBind(); Session["InsGridSource"] = rdInsLines.DataSource; foreach (GridItem item in rdInsLines.MasterTableView.Controls[0].Controls) { if (item is GridDataItem) { GridDataItem dataItem = (GridDataItem)item; if (dataItem["LSS_INSURANCE_LINE_KEY"].Text == "0") { item.FireCommandEvent("ExpandCollapse", String.Empty); } } } } } catch (Exception ex) { throw new Exception( "Exception in btnAddIns_onClick " + ex.Message); } } protected void rdInsLines_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { rdInsLines.DataSource = Session["InsGridSource"] as DataTable; } internal override bool ValidateData() { insuranceData = new InsuranceData(); foreach (GridItem item in rdInsLines.MasterTableView.Controls[0].Controls) { if (item is GridDataItem) { if (item.Expanded) { item.FireCommandEvent("ExpandCollapse", String.Empty); } item.FireCommandEvent("Validate", String.Empty); GridDataItem dataItem = (GridDataItem)item; insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.LSS_INSURANCE_TYPE, dataItem[DBEscrowServicing.LSS_INSURANCE_TYPE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_TYPE_MDESC, dataItem[DBEscrowServicing.INSURANCE_TYPE_MDESC].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.POLICY_NUMBER, dataItem[DBEscrowServicing.POLICY_NUMBER].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.PAYMENTS_PER_YEAR, dataItem[DBEscrowServicing.PAYMENTS_PER_YEAR].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.EFFECTIVE_DATE, dataItem[DBEscrowServicing.EFFECTIVE_DATE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.DUE_DATE, dataItem[DBEscrowServicing.DUE_DATE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.PAID_IND, dataItem[DBEscrowServicing.PAID_IND].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.EXPIRATION_DATE, dataItem[DBEscrowServicing.EXPIRATION_DATE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.COVERAGE_AMOUNT, dataItem[DBEscrowServicing.COVERAGE_AMOUNT].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.YEARLY_PREMIUM, dataItem[DBEscrowServicing.YEARLY_PREMIUM].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.AGENCY_NAME, dataItem[DBEscrowServicing.AGENCY_NAME].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.AGENCY_PHONE_NUMBER, dataItem[DBEscrowServicing.AGENCY_PHONE_NUMBER].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_CITY, dataItem[DBEscrowServicing.INSURANCE_COMPANY_CITY].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_NAME, dataItem[DBEscrowServicing.INSURANCE_COMPANY_NAME].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_PHONE, dataItem[DBEscrowServicing.INSURANCE_COMPANY_PHONE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_STATE, dataItem[DBEscrowServicing.INSURANCE_COMPANY_STATE].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_STREET, dataItem[DBEscrowServicing.INSURANCE_COMPANY_STREET].Text); insuranceData.InsuranceDataTable.Rows.Find(dataItem[DBEscrowServicing.LSS_INSURANCE_LINE_KEY].Text).SetField( DBEscrowServicing.INSURANCE_COMPANY_ZIP, dataItem[DBEscrowServicing.INSURANCE_COMPANY_ZIP].Text); } } // Update the Session data Session["InsGridSource"] = insuranceData.InsuranceDataTable; if (errorCount == 0) { lblInsuranceError.Visible = false; return true; } else { lblInsuranceError.Visible = true; return false; } } private void LoadNestedView(String InsType, GridDataItem dataItem, GridCommandEventArgs e) { Label InsName = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label30"); InsName.Visible = true; Label InsAddress = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label25"); InsAddress.Visible = true; Label InsCity = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label26"); InsCity.Visible = true; Label InsState = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label29"); InsState.Visible = true; Label InsZip = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label31"); InsZip.Visible = true; Label InsPhone = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label32"); InsPhone.Visible = true; Label InsCo = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label18"); InsCo.Visible = true; Label Policy = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label24"); Policy.Visible = true; Label PolicyNo = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label19"); PolicyNo.Visible = true; Label DueDate = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblDueDate"); DueDate.Visible = true; Label lblStatus = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("lblStatus"); lblStatus.Visible = true; RadTextBox InsuranceCo = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCompany"); InsuranceCo.Visible = true; InsuranceCo.Text = dataItem["INSURANCE_COMPANY_NAME"].Text; RadTextBox InsuranceStreet = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsAddress"); InsuranceStreet.Visible = true; InsuranceStreet.Text = dataItem["INSURANCE_COMPANY_STREET"].Text; RadTextBox InsuranceCity = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsCity"); InsuranceCity.Visible = true; InsuranceCity.Text = dataItem["INSURANCE_COMPANY_CITY"].Text; RadComboBox InsuranceState = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("ddInsState"); InsuranceState.Visible = true; InsuranceState.SelectedValue = dataItem["INSURANCE_COMPANY_STATE"].Text; RadMaskedTextBox InsuranceZip = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsZip"); InsuranceZip.Visible = true; InsuranceZip.Text = dataItem["INSURANCE_COMPANY_ZIP"].Text; RadMaskedTextBox InsurancePhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtInsPhone"); InsurancePhone.Visible = true; InsurancePhone.Text = dataItem["INSURANCE_COMPANY_PHONE"].Text; RadTextBox PolicyNumber = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtPolicyNumber"); PolicyNumber.Visible = true; PolicyNumber.Text = dataItem["POLICY_NUMBER"].Text; RadDatePicker dtDueDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdDueDate"); dtDueDate.Visible = true; if ((dataItem["DUE_DATE"].Text != "") && (dataItem["DUE_DATE"].Text != "")) dtDueDate.SelectedDate = Convert.ToDateTime(dataItem["DUE_DATE"].Text.ToString()); RadComboBox Status = (RadComboBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("cboStatus"); Status.Visible = true; Status.SelectedValue = dataItem["PAID_IND"].Text; if ((InsType != "998") && (InsType != "999")) { Label Label33 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label33"); Label33.Visible = true; Label Label34 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label34"); Label34.Visible = true; Label Label44 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label44"); Label44.Visible = true; Label Label51 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label51"); Label51.Visible = true; Label Label39 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label39"); Label39.Visible = true; Label Label42 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label42"); Label42.Visible = true; RadTextBox AgencyName = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyName"); AgencyName.Visible = true; AgencyName.Text = dataItem["AGENCY_NAME"].Text; RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); AgencyPhone.Visible = true; AgencyPhone.Text = dataItem["AGENCY_PHONE_NUMBER"].Text; RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); EffectiveDate.Visible = true; if (dataItem["EFFECTIVE_DATE"].Text != "") EffectiveDate.SelectedDate = Convert.ToDateTime(dataItem["EFFECTIVE_DATE"].Text.ToString()); RadDatePicker ExpirationDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); ExpirationDate.Visible = true; if ((dataItem["EXPIRATION_DATE"].Text != "") && (dataItem["EXPIRATION_DATE"].Text != "")) ExpirationDate.SelectedDate = Convert.ToDateTime(dataItem["EXPIRATION_DATE"].Text.ToString()); RadNumericTextBox CoverageAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtCoverageAmount"); String amount = dataItem["COVERAGE_AMOUNT"].Text.Replace("$", ""); CoverageAmount.Visible = true; if (amount != "") CoverageAmount.Text = amount; RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); String amount2 = dataItem["YEARLY_PREMIUM"].Text.Replace("$", ""); YearlyPremium.Visible = true; if (amount2 != "") YearlyPremium.Text = amount2; Label MonAmount = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label43"); MonAmount.Visible = false; Label Label49 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label49"); Label49.Visible = false; RadNumericTextBox MonthlyAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); MonthlyAmount.Visible = false; RadDatePicker PMIEffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); PMIEffectiveDate.Visible = false; } else { Label Label33 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label33"); Label33.Visible = false; Label Label34 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label34"); Label34.Visible = false; Label Label44 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label44"); Label44.Visible = false; Label Label51 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label51"); Label51.Visible = false; Label Label39 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label39"); Label39.Visible = false; Label Label42 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label42"); Label42.Visible = false; RadTextBox AgencyName = (RadTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyName"); AgencyName.Visible = false; RadMaskedTextBox AgencyPhone = (RadMaskedTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtAgencyPhone"); AgencyPhone.Visible = false; RadDatePicker EffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdEffectiveDate"); EffectiveDate.Visible = false; RadDatePicker ExpirationDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdExpirationDate"); ExpirationDate.Visible = false; RadNumericTextBox CoverageAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtCoverageAmount"); CoverageAmount.Visible = false; RadNumericTextBox YearlyPremium = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtYearlyPremium"); YearlyPremium.Visible = false; Label MonAmount = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label43"); MonAmount.Visible = true; Label Label49 = (Label)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("Label49"); Label49.Visible = true; RadNumericTextBox MonthlyAmount = (RadNumericTextBox)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("txtMonthlyPremium"); String amount = dataItem["YEARLY_PREMIUM"].Text.Replace("$", ""); MonthlyAmount.Visible = true; if (amount != "") MonthlyAmount.Text = amount; RadDatePicker PMIEffectiveDate = (RadDatePicker)((GridDataItem)e.Item).ChildItem.FindControl("InnerInsContainer").FindControl("rdPMIEffectiveDate"); PMIEffectiveDate.Visible = true; if (dataItem["EFFECTIVE_DATE"].Text != "") PMIEffectiveDate.SelectedDate = Convert.ToDateTime(dataItem["EFFECTIVE_DATE"].Text.ToString()); } } protected void ddInsuranceTypes_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { foreach (GridItem item in rdInsLines.MasterTableView.Controls[0].Controls) { if (item is GridDataItem) { if (item.Expanded) { GridDataItem dataItem = item as GridDataItem; RadComboBox InsuranceType = (RadComboBox)(dataItem.ChildItem.FindControl("InnerInsContainer").FindControl("ddInsuranceTypes")); dataItem["LSS_INSURANCE_TYPE"].Text = InsuranceType.SelectedValue; item.FireCommandEvent("Custom", String.Empty); } } } } } }