Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
217 views
I have nested radgrids in following order

Main RadGrid
Nested View Template
Tab Strip Control
Multi Page view
Rad Grid as child

I am using web user control for Edit/Insert in all child grids. How can I handle Insert and Update commands from child grids.  
Here is markup as is

<telerik:RadGrid  Width="100%" ID="MasterGrid" HorizontalAlign="Center"  runat="server"
             AllowSorting="True" ShowStatusBar="true" AllowAutomaticUpdates="true" ShowFooter="true" AllowAutomaticDeletes="true"  AllowFilteringByColumn="True"  AllowMultiRowSelection="False" AllowPaging="True" ShowGroupPanel="True" AutoGenerateColumns="False" GridLines="none">
            <GroupingSettings CaseSensitive="false" />
            <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"/>
                       <ExportSettings HideStructureColumns="true" />     
                 
                <MasterTableView Width="100%" ShowGroupFooter="true"  CommandItemDisplay="Top" DataKeyNames="custid" TableLayout="Auto"  Name="Customers">
 
                 
                   <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="Agency" FieldName="Agency"></telerik:GridGroupByField>
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="Agency"></telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                                                         
                      <%--<CommandItemSettings ShowAddNewRecordButton="false"  ShowExportToWordButton="true" ShowExportToExcelButton="true"
                        ShowExportToCsvButton="true" />   --%>
                                                                                             
                    <CommandItemTemplate>
                          <div style="padding: 5px 5px;">
                                                <asp:LinkButton ID="btnExpandAll" runat="server" CommandName="ExpandAll" Visible="false"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Plus.gif" />Expand All</asp:LinkButton>  
                                                <asp:LinkButton ID="btnCollapseAll" runat="server" CommandName="CollapseAll" Visible="false"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Minus.gif" />Collapse All</asp:LinkButton>  
                                                <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# MasterGrid.EditIndexes.Count = 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>  
                                                <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# MasterGrid.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Update</asp:LinkButton>  
                                                <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# MasterGrid.EditIndexes.Count > 0 Or MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" />Cancel editing</asp:LinkButton>  
                                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# Not MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>  
                                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" />Add this customer</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
                        runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected customers</asp:LinkButton>  
                                                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Refresh.gif" />Refresh customer list</asp:LinkButton>
                                            </div>  
                    </CommandItemTemplate
                                                         
                     
                    <NestedViewTemplate>
                    <fieldset class="viewWrap" runat="server">
                           <asp:Panel runat="server" ID="InnerContainer" Visible="true">
                           <telerik:RadTabStrip EnableViewState="true" OnClientTabSelected="onTabSelected" runat="server" Skin='<%# RadComboBox1.selectedItem.text %>'  ID="TabStrip1" MultiPageID="Multipage1"
                                SelectedIndex="0">
                                <Tabs>
                                    <telerik:RadTab runat="server" Text="Support" PageViewID="RadPageView1"/>
                                    <telerik:RadTab runat="server" Text="Sales" PageViewID="RadPageView2"/>
                                    <telerik:RadTab runat="server" Text="General Info" PageViewID="RadPageView3"/>
                                    <telerik:RadTab runat="server" Text="System Info" PageViewID="RadPageView4"/>
                                    <telerik:RadTab runat="server" Text="Notes" PageViewID="RadPageView5"/>
                                    <telerik:RadTab runat="server" Text="Shipping" PageViewID="RadPageView6"/>
                                    <telerik:RadTab runat="server" Text="Contact" PageViewID="RadPageView7"/>
                                    <telerik:RadTab runat="server" Text="Configuration" PageViewID="RadPageView8"/>
                                    <telerik:RadTab runat="server" Text="SAM" PageViewID="RadPageView9"/>
                                </Tabs>
                            </telerik:RadTabStrip>
                             
                              <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                                     <telerik:RadPageView runat="server" ID="RadPageView1">
                                            <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("sid") %>' Visible="false" runat="server" />
                                            <telerik:RadGrid Skin='<%# RadComboBox1.selectedItem.text %>' Width="100%" ID="RadPageViewGrid1" AllowAutomaticUpdates="true"   DataSourceID="SqlDataSource2" HorizontalAlign="Center"  runat="server"
                                                AllowSorting="True" AllowFilteringByColumn="False"  AllowMultiRowSelection="False" ShowGroupPanel="true" AllowPaging="True" autoGenerateColumns="False" GridLines="none">
  
                                     <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                                        DataKeyNames="recid" HierarchyLoadMode="ServerOnDemand" CommandItemDisplay="Top">
                                                       <CommandItemSettings ShowAddNewRecordButton ="false" />
                                                           <CommandItemTemplate>
                                                                  <div style="padding: 5px 5px;">
                                                                                        <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='true'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>  
                                                                                        <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='false'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Update</asp:LinkButton>  
                                                                                        <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# MasterGrid.EditIndexes.Count > 0 Or MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" />Cancel editing</asp:LinkButton>  
                                                                                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# Not MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>  
                                                                                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" />Add this customer</asp:LinkButton>  
                                                                <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
                                                                runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected customers</asp:LinkButton>  
                                                                                        <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Refresh.gif" />Refresh customer list</asp:LinkButton>
                                                                                    </div>  
                                                            </CommandItemTemplate
                     
                                                             <Columns>
                                                            <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                                                                <ItemTemplate>
                                                                    <asp:CheckBox id="CheckBox1" runat="server"> </asp:CheckBox>
                                                                </ItemTemplate>
                                                            </telerik:GridTemplateColumn>                                                                   
                                                            <telerik:GridDateTimeColumn EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" SortExpression="Date" HeaderText="Date" PickerType="DatePicker" HeaderButtonType="TextButton" DataField="Date" UniqueName="Date" DataFormatString="{0:MM/dd/yyyy}"/>
                                                            <telerik:GridDateTimeColumn   EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" SortExpression="Date" HeaderText="Time" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderButtonType="TextButton" DataField="Date" UniqueName="Time" DataFormatString="{0:HH:mm tt}"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" SortExpression="Duration" HeaderText="Duration" HeaderButtonType="TextButton" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" DataField="Duration" UniqueName="Duration"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" SortExpression="Initials" HeaderText="Created By" HeaderButtonType="TextButton" DataField="Initials" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="Initials"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="Description" HeaderText="Issue Type" HeaderButtonType="TextButton" DataField="Description" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="Description"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="LogStatus" HeaderText="Status" HeaderButtonType="TextButton" DataField="LogStatus" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="LogStatus"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="name" HeaderText="Customer Contact" HeaderButtonType="TextButton" DataField="name" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="name"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="phone" HeaderText="Call back #" HeaderButtonType="TextButton" DataField="phone" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="phone"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="2" ItemStyle-HorizontalAlign="Left" ColumnEditorID="GridTextBoxColumnEditor2" SortExpression="problem" HeaderText="Purpose" HeaderButtonType="TextButton" DataField="problem" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="problem"/>
                                                            <telerik:GridBoundColumn EditFormColumnIndex="2" ItemStyle-HorizontalAlign="Left" ColumnEditorID="GridTextBoxColumnEditor2"  SortExpression="solution" HeaderText="Result" HeaderButtonType="TextButton" DataField="solution" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="resolution"/>
                                                            
                                                        </Columns>
                                                       
                                                       
                                                                         <EditFormSettings UserControlName="~/UserControls/Support.ascx" EditFormType="WebUserControl">
                                                                            <EditColumn UniqueName="EditCommandColumn1">              
                                                                            </EditColumn>
                                                                        </EditFormSettings>
                                                                         
                                        </MasterTableView>
                                         
                                             <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                                                    <Selecting AllowRowSelect="True"></Selecting>
                                                    <Resizing AllowRowResize="False" ResizeGridOnColumnResize="False"></Resizing>
                                                    <ClientEvents OnRowDblClick="RowDblClick" OnColumnClick="ColumnClick" />
                                                </ClientSettings>
                                                <GroupingSettings ShowUnGroupButton="true" />      
                                     </telerik:RadGrid
                                      
                                                <telerik:GridTextBoxColumnEditor TextBoxMode="MultiLine" TextBoxStyle-Width="300px" TextBoxStyle-height="100px" ID="GridTextBoxColumnEditor2" runat="server">
                                                    <TextBoxStyle  BackColor="#edffc3" />
                                                </telerik:GridTextBoxColumnEditor>
                                                 
                                     <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                                                        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM vw_SupportLogs Where sid = @ScannerId
                                                        Order BY [Date] Desc"
                                                        runat="server">
                                                        <SelectParameters>
                                                            <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="ScannerId" />
                                                        </SelectParameters>
                                      </asp:SqlDataSource
                                      
                                     </telerik:RadPageView>
 
                                       <telerik:RadPageView runat="server" ID="RadPageView2">
                                                                    
                                        </telerik:RadPageView>
                                         
                                       <telerik:RadPageView runat="server" ID="RadPageView3">
                                         
                                        </telerik:RadPageView>
 
                                       <telerik:RadPageView runat="server" ID="RadPageView4">
                                         
                                        </telerik:RadPageView>
                                         
                                       <telerik:RadPageView runat="server" ID="RadPageView5">
                                                    <asp:Label ID="Label2" Font-Bold="true" Font-Italic="true" Text='<%# Eval("sid") %>' Visible="false" runat="server" />
                                          
                                                 <telerik:RadGrid Skin='<%# RadComboBox1.selectedItem.text %>'  runat="server" ID="RadPageViewGrid5" DataSourceID="SqlDataSource3" ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false">
                                                 <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                                                    DataKeyNames="recid" HierarchyLoadMode="ServerOnDemand" CommandItemDisplay="Top">
                                                                    
                                                                   <CommandItemSettings ShowAddNewRecordButton="false" />
                                                                    <CommandItemTemplate>
                                                                          <div style="padding: 5px 5px;">
                                                                                                <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# MasterGrid.EditIndexes.Count = 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# MasterGrid.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Update</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# MasterGrid.EditIndexes.Count > 0 Or MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" />Cancel editing</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# Not MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" />Add this customer</asp:LinkButton>  
                                                                        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
                                                                        runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected customers</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Refresh.gif" />Refresh customer list</asp:LinkButton>
                                                                                            </div>  
                                                                    </CommandItemTemplate
                     
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBox id="CheckBox1" runat="server"> </asp:CheckBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>                                                                    
                                                                        <telerik:GridDateTimeColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="Date" HeaderText="Date" PickerType="DatePicker" HeaderButtonType="TextButton" DataField="Date" UniqueName="Date" DataFormatString="{0:MM/dd/yyyy}"/>
                                                                        <telerik:GridDateTimeColumn   EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="Date" HeaderText="Time" HeaderButtonType="TextButton" DataField="Date" UniqueName="Time" DataFormatString="{0:HH:mm tt}"/>
                                                                        <telerik:GridBoundColumn EditFormColumnIndex="1" ItemStyle-HorizontalAlign="Left" SortExpression="LoggedBy" HeaderText="Logged By" HeaderButtonType="TextButton" DataField="LoggedBy" UniqueName="LoggedBy"/>
                                                                        <telerik:GridBoundColumn EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" SortExpression="TypeOfNote" HeaderText="Type Of Note" HeaderButtonType="TextButton" DataField="TypeOfNote" UniqueName="TypeOfNote"/>
                                                                        <telerik:GridBoundColumn ColumnEditorID="TextEditor1"  EditFormColumnIndex="0" ItemStyle-HorizontalAlign="Left" SortExpression="Notes" HeaderText="Notes" HeaderButtonType="TextButton" DataField="Notes" UniqueName="Notes"/>
                                                                    </Columns>
                                                                   
                                                                         <EditFormSettings UserControlName="~/UserControls/Notes.ascx" EditFormType="WebUserControl">
                                                                            <EditColumn UniqueName="EditCommandColumn1">              
                                                                            </EditColumn>
                                                                        </EditFormSettings>
                             
                                                    </MasterTableView>
                                                     
                                                                <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                                                                        <Selecting AllowRowSelect="True"></Selecting>
                                                                        <ClientEvents OnRowDblClick="RowDblClick" />
                                                                    </ClientSettings>
                                                 </telerik:RadGrid
                                                  
                                                 
                                                                <telerik:GridTextBoxColumnEditor TextBoxMode="MultiLine" TextBoxStyle-Width="300px" TextBoxStyle-height="100px" ID="TextEditor1" runat="server">
                                                                <TextBoxStyle  BackColor="#edffc3" />
                                                            </telerik:GridTextBoxColumnEditor>
                         
                                                 <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                                                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Notes Where sid = @ScannerID
                                                                    Order BY [Date] Desc"
                                                                    runat="server">
                                                                    <SelectParameters>
                                                                        <asp:ControlParameter ControlID="Label2" PropertyName="Text" Type="String" Name="ScannerID" />
                                                                    </SelectParameters>
                                                  </asp:SqlDataSource>   
                                        </telerik:RadPageView>
 
                                       <telerik:RadPageView runat="server" ID="RadPageView6">
                                         
                                        </telerik:RadPageView>
                                         
                                       <telerik:RadPageView runat="server" ID="RadPageView7">
 
                                                   <asp:Label ID="Label3" Font-Bold="true" Font-Italic="true" Text='<%# Eval("sid") %>' Visible="False" runat="server" />
                                          
                                                 <telerik:RadGrid Skin='<%# RadComboBox1.selectedItem.text %>' runat="server" ID="RadPageViewGrid7" DataSourceID="SqlDataSource4" ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false">
                                                  
                                    
                                                 <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                                                    DataKeyNames="id" HierarchyLoadMode="ServerOnDemand" CommandItemDisplay="Top">
                                                                    
                                                                    <CommandItemSettings ShowAddNewRecordButton="false" />
                                                                    <CommandItemTemplate>
                                                                          <div style="padding: 5px 5px;">
                                                                                                <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# MasterGrid.EditIndexes.Count = 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# MasterGrid.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Update</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# MasterGrid.EditIndexes.Count > 0 Or MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" />Cancel editing</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# Not MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# MasterGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" />Add this customer</asp:LinkButton>  
                                                                        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
                                                                        runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected customers</asp:LinkButton>  
                                                                                                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Refresh.gif" />Refresh customer list</asp:LinkButton>
                                                                                            </div>  
                                                                    </CommandItemTemplate
                                                                     
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBox id="CheckBox1" runat="server"> </asp:CheckBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>                                                                   
                                                                        <telerik:GridBoundColumn  ItemStyle-HorizontalAlign="Left" SortExpression="ContactProfileName" HeaderText="Contact Profile" HeaderButtonType="TextButton" DataField="ContactProfileName" UniqueName="ContactProfileName"/>
                                                                        <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" SortExpression="EntityName" HeaderText="Entity Name" HeaderButtonType="TextButton" DataField="EntityName" UniqueName="EntityName"/>
                                                                        <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" SortExpression="FullName" HeaderText="Full Name" HeaderButtonType="TextButton" DataField="FullName" UniqueName="FullName"/>
                                                                        <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" SortExpression="Phone" HeaderText="Phone" HeaderButtonType="TextButton" DataField="Phone" UniqueName="Phone"/>
                                                                        <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" SortExpression="Mobile" HeaderText="Mobile" HeaderButtonType="TextButton" DataField="Mobile" UniqueName="Mobile"/>
                                                                        <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" SortExpression="Email" HeaderText="Email" HeaderButtonType="TextButton" DataField="Email" UniqueName="Email"/>
                                                                    </Columns>
                                                                   
                                                                    
                                                                         <EditFormSettings UserControlName="~/UserControls/Contact.ascx" EditFormType="WebUserControl">
                                                                            <EditColumn UniqueName="EditCommandColumn1">              
                                                                            </EditColumn>
                                                                        </EditFormSettings>
                            
                                                    </MasterTableView>
                                                     
                                                                <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                                                                        <Selecting AllowRowSelect="True"></Selecting>
                                                                        <ClientEvents OnRowDblClick="RowDblClick" />
                                                                    </ClientSettings>
                                                 </telerik:RadGrid
                                                  
                                                 
                                                                <telerik:GridTextBoxColumnEditor TextBoxMode="MultiLine" TextBoxStyle-Width="300px" TextBoxStyle-height="100px" ID="GridTextBoxColumnEditor1" runat="server">
                                                                <TextBoxStyle  BackColor="#edffc3" />
                                                            </telerik:GridTextBoxColumnEditor>
                         
                                                 <asp:SqlDataSource ID="SqlDataSource4" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                                                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM vw_Contacts Where sid = @ScannerID Order By CreateDate Desc"
                                                                    runat="server">
                                                                    <SelectParameters>
                                                                        <asp:ControlParameter ControlID="Label3" PropertyName="Text" Type="String" Name="ScannerID" />
                                                                    </SelectParameters>
                                                  </asp:SqlDataSource>
 
                                                 <asp:SqlDataSource ID="SqlDataSource5" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                                                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ContactProfileId],[ContactProfileName] FROM [ContactProfileMaster]"
                                                                    runat="server">
                                                  </asp:SqlDataSource>
                                                                                                                        
                                        </telerik:RadPageView>
                             
                           <telerik:RadPageView runat="server" ID="RadPageView8">
                             
                            </telerik:RadPageView>
                             
                           <telerik:RadPageView runat="server" ID="RadPageView9">
                             
                            </telerik:RadPageView
                                                                  
                              </telerik:RadMultiPage>
                            </asp:Panel>
                    </fieldset>
                    </NestedViewTemplate>
                                                
                   <Columns>
                        
                       <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                       </telerik:GridEditCommandColumn>
                     
                        <telerik:GridBoundColumn EditFormColumnIndex="0" Aggregate="Count" FooterText="Total Records: " SortExpression="Agency" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="Agency" HeaderButtonType="TextButton"
                            DataField="Agency">
                        </telerik:GridBoundColumn>
 
                        <telerik:GridBoundColumn EditFormColumnIndex="0" SortExpression="blsid" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="BLSID"
                         HeaderButtonType="TextButton"
                            DataField="blsid">
                        </telerik:GridBoundColumn>
 
                        <telerik:GridBoundColumn EditFormColumnIndex="0" SortExpression="scannerid" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="LSID" HeaderButtonType="TextButton"
                            DataField="scannerid">
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn EditFormColumnIndex="0" SortExpression="groupnum" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="Group" HeaderButtonType="TextButton"
                            DataField="groupnum">
                        </telerik:GridBoundColumn>
                                  
                        <telerik:GridBoundColumn EditFormColumnIndex="0" SortExpression="maintenance" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="Support Type" HeaderButtonType="TextButton"
                            DataField="maintenance">
                        </telerik:GridBoundColumn
                                
                        <telerik:GridDateTimeColumn EditFormColumnIndex="0" FilterControlWidth="120px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" DataField="maintExp" HeaderText="Support Exp Date"
                            SortExpression="maintExp" UniqueName="maintExp" PickerType="DatePicker"
                            DataFormatString="{0:MM/dd/yyyy}">
                            <HeaderStyle Width="160px" />
                        </telerik:GridDateTimeColumn>
                         
                        <telerik:GridBoundColumn EditFormColumnIndex="1" SortExpression="Description" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="Scanner Model" HeaderButtonType="TextButton"
                            DataField="Description">
                        </telerik:GridBoundColumn>                                 
 
                        <telerik:GridBoundColumn EditFormColumnIndex="1" SortExpression="buildver" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="SW Version" HeaderButtonType="TextButton"
                            DataField="buildver">
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn EditFormColumnIndex="1" SortExpression="ReleaseDate" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="True" HeaderText="Rel Date" HeaderButtonType="TextButton"
                            DataField="ReleaseDate">
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn EditFormColumnIndex="2" SortExpression="Make" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderText="PC" HeaderButtonType="TextButton"
                            DataField="Make">
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn EditFormColumnIndex="2" SortExpression="ostype" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderText="OS" HeaderButtonType="TextButton"
                            DataField="ostype">
                        </telerik:GridBoundColumn>  
                </Columns>
                 
                 
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="19px" />
                    </ExpandCollapseColumn>
                     
                  <EditFormSettings EditFormType="Template">
                             <FormTemplate>
                                <table style="width:100%;">
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox1" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox7" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox10"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox2" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox17" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox18"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox19" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox20" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox21"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox22" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox23" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox24"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox25" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox26" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox27"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="20%" align="right">
                                            Contact Profile: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox28" Text='<%# Bind("Agency") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Phone: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox29" Text='<%# Bind("scannerid") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                        <td width="20%" align="right">
                                            Address 1: </td>
                                        <td width="20%" align="left">
                                            <telerik:RadTextBox ID="RadTextBox30"  Text='<%# Bind("groupnum") %>' Runat="server" Width="300px"></telerik:RadTextBox>
                                        </td>
                                    </tr>                                                                                                                                                                                   
                                </table>
                             </FormTemplate>
                  </EditFormSettings>
            </MasterTableView>
             
            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                <Selecting AllowRowSelect="True"></Selecting>
                <Resizing AllowRowResize="False" ResizeGridOnColumnResize="False"></Resizing>
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>           
            <GroupingSettings ShowUnGroupButton="true" />
        </telerik:RadGrid>




Iana Tsolova
Telerik team
 answered on 03 Feb 2011
5 answers
204 views
Hi;
I am using Telerik RadGrid in a panel which open by modal extender popup.
but some how in IE6.0 the background is not greyed but work fine in IE8.0
I think it has do some thing with z-index property in both browser
Can you please tell What is the z index property set for Telerik RadGrid
in IE8.0 and in IE 6.0
Daniel
Telerik team
 answered on 03 Feb 2011
2 answers
128 views
I have a page with a panel (pnlA), a radcombobox and a usercontrol. I have added ajaxsettings which allow the radcombobox to update the panel using ajax. I would like for the controls in the usercontrol to also update the panel. I have tried to add ajaxsettings so that the usercontrol itself is the ajaxified control. I have also tried wrapping the user control in a panel and using this container panel as the ajaxified control.  I have tried wrapping the controls in the usercontrol in a panel and then exposing this panel as a property of the user control, and then setting this as the ajaxified control. Lastly, I have tried exposing the individual controls as properties of the usercontrol, and then setting these as the ajaxifiedcontrols. None of these seems to allow the controls within the user control to update the original panel (pnlA) in my page. How can I do this?
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 03 Feb 2011
1 answer
85 views
Hi,
I am using 2009.3.1103.20 version of Telerik Controls.
Now, on my RadGrid, I process something serverside when row is clicked, and then visible other panel of my page.
Everything works fine but actually I want to display progressbar when Grid's row is clicked and its processing something.
I already have a Div which I display on everypostback to display progressbar and I want to call the same javascript function to display that progressbar when Grid's row is clicked.
I tried but could not achieve this.
So what I am looking for here is, when Grid's row is clicked, Want to call a javascript function which displays progressbar.
I need to pass clicked Row as object so that I can display progressbar at the same level, if its not possible, I can surely pass RadGrid itself to display progressbar at top of Grid. But my first preference is passing Row as object to my function.
Here is my code.
<div class="Scrollgrid" style="width: 1100px; height: 600px;"
                                                <telerik:RadGrid ID="RadGridAllRequests" runat="server" AllowPaging="true" AllowSorting="true"
                                                    AllowFilteringByColumn="true" AutoGenerateColumns="False" BorderStyle="None"
                                                    GridLines="Both" OnNeedDataSource="RadGridAllRequests_needdatasource" OnItemDataBound="RadGridAllRequests_ItemDataBound"
                                                    OnItemCreated="RadGridAllRequests_ItemCreated" OnItemCommand="RadGridAllRequests_ItemCommand"
                                                         
                                                         
                                                    AllowMultiRowSelection="true" SelectedItemStyle-CssClass="SelectedItem" Width="100%"
                                                    Skin="WebBlue"
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" AlwaysVisible="true" /> 
                                                    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true"
                                                        <Selecting AllowRowSelect="true" /> 
<%--<ClientEvents OnRowClick="RowClicked" />--%>
                                                    </ClientSettings
                                                        
                                                        
                                                        
                                                    <MasterTableView 
                                                           
                                                    ShowHeadersWhenNoRecords="true" 
                                                    AllowFilteringByColumn="true" DataKeyNames="RequestInfoID"
                                                        <Columns
                                                                
                                                            <telerik:GridNumericColumn DataField="RequestInfoID" HeaderText="Request No." SortExpression="RequestInfoID"
                                                                DataType="System.Int64" FilterControlWidth="40px" HeaderStyle-Width="100px"
                                                                      
                                                                
                                                                       
                                                            </telerik:GridNumericColumn
</Columns
                                                        <EditFormSettings
                                                            <PopUpSettings ScrollBars="None" /> 
                                                        </EditFormSettings
                                                        <ExpandCollapseColumn Resizable="False" Visible="False"
                                                            <HeaderStyle /> 
                                                        </ExpandCollapseColumn
                                                        <RowIndicatorColumn Visible="False"
                                                            <HeaderStyle /> 
                                                        </RowIndicatorColumn
                                                    </MasterTableView
                                                </telerik:RadGrid
                                            </div>
  
  
  
  
DIV AT THE BOTTOM OF PAGE:
    <div class="WaitDisplay" id="divWait" style="display: none; width: auto;">
        <img alt="" src="Images/spinner2.gif" />
        <div id="divWaitMessage">
            Processing...
        </div>
    </div>
  
  
  
JAVASCRIPT:
  
function buttonClicked_WithObj(obj) {
  
    divWaitMessage.innerHTML = "Processing........<br />Please wait<br />"
    displayBanner_WithObj(divWait, obj);
}
  
function displayBanner_WithObj(oDiv, obj) {
    oDiv.style.position = "absolute";
  
  
    var leftPos = getAbsoluteLeft(obj);
    var topPos = getAbsoluteTop(obj);
  
  
    oDiv.style.top = topPos - 30;
    oDiv.style.left = leftPos;
  
    oDiv.style.display = "block";
  
}
  
  
function getAbsoluteLeft(oNode) {
    var oCurrentNode = oNode;
    var iLeft = 0;
    while (oNode != null && oCurrentNode.tagName != "BODY") {
        iLeft += oCurrentNode.offsetLeft;
        oCurrentNode = oCurrentNode.offsetParent;
    }
  
    return iLeft;
}
  
function getAbsoluteTop(oNode) {
    var oCurrentNode = oNode;
    var iTop = 0;
    while (oNode != null && oCurrentNode.tagName != "BODY") {
        iTop += oCurrentNode.offsetTop;
        oCurrentNode = oCurrentNode.offsetParent;
    }
    return iTop;
}

Now in Above code, I want to call something like
onRowClick="javascript:Page_BlockSubmit = false;buttonClicked_WithObj(this);"

Any idea how can I call this javascript function to display my Div by passing clicked row as object or by passing Grid as object?

This javascript is working fine for all the controls on screen so just need to call to display progressbar on clicked row.

Thanks in advance,





Maria Ilieva
Telerik team
 answered on 03 Feb 2011
1 answer
100 views
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.

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

 

 

 

Tsvetina
Telerik team
 answered on 03 Feb 2011
0 answers
70 views
hi team,

i found a solution to show all appointments in grid... i need to show current day events in grid...



also need to show the recurrence for current days +7 or -7 in another grid... !!!



can anyone help on this
ganesh
Top achievements
Rank 2
 asked on 03 Feb 2011
1 answer
137 views
Hi Telerik,
I need to achieve the fuction set_text like get_text.Because i append some text from database .That why i am asking.......
Thank you.
Rumen
Telerik team
 answered on 03 Feb 2011
1 answer
43 views
Hi;
I am using RADLIST BOX drag and drop functionality.
My question is how can I find which value User has selected to Drag from One list box to another
For Example:
I have one Listbox as ListBox1 which contains value India,SriLanka,USA etc.... How Can I find user has selected India to drag and drop
from ListBox1 to ListBox2  and viceversa.

From ListBox1 to ListBox2  If I fire sever side event "OnTransferred" then I can easily track the value but my question is IF the user drag and drop some value like India from ListBox2  to ListBox1 how can I find this Value

Please Reply ASAP it is very Urgent 
Princy
Top achievements
Rank 2
 answered on 03 Feb 2011
7 answers
135 views
Hi,
how to translate label ("Update", "Cancel") in pop-up of RadGrid:

http://img844.imageshack.us/img844/1816/przechwytywanietz.png

Thanks :)
Daniel
Telerik team
 answered on 03 Feb 2011
1 answer
71 views
Hi,

I have a radgrid, with a delete option as below:

<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>   
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnlMaster">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlMaster" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
  
  
<telerik:RadGrid ID="grdCompanyList"
                runat="server" GridLines="None"
                AutoGenerateColumns="False"
                AllowSorting="True"
                AllowFilteringByColumn = "True"
                AllowPaging="True"
                EnableLinqExpressions="False"
                PageSize="10"
                OnNeedDataSource="grdCompanyList_NeedDataSource"                
                OnItemDataBound="grdCompanyList_ItemDataBound"
                OnItemCommand = "grdCompanyList_ItemCommand">
                  
                <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>                                
                <MasterTableView DataKeyNames="watchlist_id" CommandItemDisplay="Top" EditMode="PopUp">
                <CommandItemSettings ShowAddNewRecordButton="false"/>
                <Columns>
  
                    <telerik:GridBoundColumn DataField="watchlist_id" DataType="System.Int32" 
                        HeaderText="watchlist_id" ReadOnly="True" SortExpression="watchlist_id" 
                        UniqueName="watchlist_id" Visible="false" >
                    </telerik:GridBoundColumn>
                      
                    <telerik:GridBoundColumn DataField="company_id" DataType="System.Int32" 
                        HeaderText="company_id" ReadOnly="True" SortExpression="company_id" 
                        UniqueName="company_id" Visible="false" >
                    </telerik:GridBoundColumn>
                      
                    <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-Width="180px">
                    <ItemTemplate>
                        <asp:Image width="142" height="58" ID="CompLogos" ImageUrl="<%# showCompLogo(Container.DataItem) %>"
                         runat="server" AlternateText="Logo" />
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>
                      
                    <telerik:GridBoundColumn DataField="company_name"
                        HeaderText="Company name" SortExpression="company_name" ItemStyle-Width="450"
                        UniqueName="company_name" ReadOnly="true">
                        <ItemStyle Width="450px" />
                    </telerik:GridBoundColumn>                   
                    
                    <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-Width="150px" HeaderText="Actions">
                    <ItemTemplate>
                        <div>
                            <span style="padding:0 5px">
                                <asp:HyperLink ID="CoLink" runat="server" ImageUrl="~/images/viewicon_big.png"
                                ToolTip="View Details"></asp:HyperLink>
                            </span>
                            <span style="padding:0 5px">                                
                                <asp:ImageButton runat="server" ID="DelButton" ImageUrl="~/images/delete-32.png" ToolTip="Delete"
                                CausesValidation="false" CommandName="Delete" />
                            </span>
                        </div>                        
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true"></ClientSettings>
                </telerik:RadGrid>

The following is the delete code in c#:

protected void grdCompanyList_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.DeleteCommandName)
        {
            GridDataItem item = (GridDataItem)e.Item;
            string iWatch = item["watchlist_id"].Text;
  
            Power50MiddleWare.BL.Watchlist oWatch = new Power50MiddleWare.BL.Watchlist();
            oWatch._WatchlistId = Int32.Parse(iWatch);
            try
            {
                int retResult = oWatch.RemoveWatchlist();
                if (retResult == 1)
                {
                    GenerateWatchlist();
                    pnlMsg.Visible = true;
                    lblMsg.Text = "Successfully deleted your watchlist item";
                }
                else
                {
                    pnlMsg.Visible = true;
                    lblMsg.Text = "Sorry could not delete the item, please contact your system administrator";
                }
            }
            catch (System.Exception exp)
            {
                pnlMsg.Visible = true;
                lblMsg.Text = exp.Message.ToString() + exp.StackTrace;
            }
        }

However when i try this, i get an JS error as attached.

Please suggest.

Thanks,

Debashis
Radoslav
Telerik team
 answered on 03 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?