Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
632 views

Hello, I am designer trying to figure how make changes to the HTML Chart. I have 3 charts inside of 3 containing DIVs set at 33%. I have a click function with JavaScript to change the width from 33% to 100% in order to expand the chart and make it easier to read. When I do this, the containing DIV expands to 100% but the chart stays at the initial rendered 33% when first loaded. I have been searching and searching trying to find a solution but have not been able. Can someone show what would be needed to make the chart refresh with click event?

The JS I have is:

$(".gridButton").click(function () {
$(".chartContainer").removeClass("grid");
            });

Marin Bratanov
Telerik team
 answered on 23 May 2017
2 answers
482 views

I'm trying to do a couple of things (picture attached):
1. Remove the empty white row that shows up when there are no records. How can I get rid of it?
2. Right below the textbox to insert a new item, there is a double line. Like the border is thicker. How can I remove the thicker border and just have a normal border at the bottom?

Here's my code:

<telerik:RadGrid ID="rgImpacts" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="True" AllowSorting="True" CellSpacing="0" DataSourceID="odsImpacts" GridLines="None" Width="800px" AutoGenerateColumns="False" OnInsertCommand="rgImpacts_InsertCommand">
    <AlternatingItemStyle BackColor="White" />
    <MasterTableView CommandItemDisplay="None" DataKeyNames="idImpactId" DataSourceID="odsImpacts" EditMode="InPlace" InsertItemDisplay="Bottom" ShowHeader="False">
        <Columns>
            <telerik:GridTemplateColumn DataField="varcharImpact" FilterControlAltText="Filter varcharImpact column" HeaderText="Impact" SortExpression="varcharImpact" UniqueName="varcharImpact">
                <EditItemTemplate>
                    <telerik:RadTextBox ID="txtImpact" runat="server" Text='<%# Bind("varcharImpact") %>' MaxLength="100" Width="600px" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblImpact" runat="server" Text='<%# Eval("varcharImpact") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="650px"></HeaderStyle>
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn FilterControlAltText="Filter EditCommandColumn column" Groupable="False" UniqueName="EditCommandColumn">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CssClass="gridLink" CommandName="Update" Text="Update" /> 
                    <asp:LinkButton ID="LinkButton2" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton4" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Edit" Text="Edit" /> 
                    <asp:LinkButton ID="LinkButton3" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Delete" Text="Delete" />
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:LinkButton ID="LinkButton5" runat="server" CssClass="gridLink" CommandName="PerformInsert" Text="Insert" />
                </InsertItemTemplate>
                <HeaderStyle Width="100px"></HeaderStyle>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="ImageButton"></EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>


public partial class ChangeRequestForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rgImpacts.MasterTableView.NoMasterRecordsText = string.Empty;
                rgImpacts.MasterTableView.NoDetailRecordsText = string.Empty;
                rgImpacts.MasterTableView.IsItemInserted = true;
                rgImpacts.Rebind();
            }
        }
 
        protected void rgImpacts_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item = e.Item as GridDataItem;
            if (item != null)
            {
                var varcharImpact = ((RadTextBox) item.FindControl("txtImpact")).Text;
                DataAccessLayer.Impacts.ImpactsInsert(varcharImpact);
                rgImpacts.Rebind();
                e.Canceled = true;
            }
        }
 
    }



Bala
Top achievements
Rank 1
 answered on 23 May 2017
0 answers
46 views
I create asp button .
 <asp:Button ID="excelImg" runat="server" class="green" Text="Excel" OnClick="ExportExcel"
                              OnClientClick="this.disable=true; this.value='Processing';"           UseSubmitBehavior="false" />
it is for Export to Excel to telerik grid. it works but. 'Processing ... ' is not still disappear even after exporting excel.
May
Top achievements
Rank 1
 asked on 23 May 2017
0 answers
120 views

Hi all,

We're using Telerik controls on our ASP.NET Web Forms page:

Here is a sample page:

http://orangebeachpublic.novusagenda.com/

If I set the Custom Date Range to something greater than 6 months, there will be multiple pages of results.

We need to be able to deep-link to a particular page (ex: page 3).

I've tried doing the obvious:

http://orangebeachpublic.novusagenda.com?page=3

But this does not work.

Is there a way for me to deep-link to a specific page of results?

Thanks,

Philip

 

Philip
Top achievements
Rank 1
 asked on 22 May 2017
0 answers
233 views

Hello,

First off I hope I am explaining this correctly.

I would like to know how to put multiple panels within a RadGrid.  I have a GridTemplateColumn that contains an ItemTemplate.  In the ItemTemplate I have a table that has several table rows.  I would like to put one panel for certain rows another panel for a second set of specific rows and so on until I get to the ending tag of the table.  I want to do this because I want to hide and show certain parts of the table based on a setting selected by the user.  From my example below you can see that I did a test on one row of the first part of the table.  I can hide or show that panel.  However when I try and do this for the other parts of the table it does not work.  In fact it seems stop the creation/display of the rest of the asp code starting with the panel tag.

So if I had a table row with "Blah"  and then a panel and in that a table row with "Blah Two" with the ending panel tag then only Blah would show regardless of how I set the state of the panel. 

I would think I could put panels within a table within a RadGrid.  However I am somewhat new to Telerik and am not sure I am doing this correctly.  The end result of what I want to do is create a RadGrid with sections that I can hide certain values based on user input that can ultimately be displayed in PDF form.  I think that if I get past the panel issue then the PDF aspect should fall into place.

 

Here is my example - Can anyone help?   Thanks Patrick

 

 

 

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
        ClientEvents-OnRequestStart="requestStart">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" DataSourceID="SqlDataSource1"
        AllowSorting="false"   Width="1200px" AllowPaging="True" AutoGenerateColumns="False"  AllowAutomaticInserts="false"  ExportSettings-ExportOnlyData="False" ExportSettings-HideStructureColumns="False" ExportSettings-IgnorePaging="False" MasterTableView-HierarchyDefaultExpanded="False">
        <ExportSettings  ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"   >
            <Pdf PageHeight="600mm" PageWidth="297mm" PageTitle="CTFP Nomination" DefaultFontFamily="Arial Unicode MS"
                PageBottomMargin="20mm" PageTopMargin="20mm" PageLeftMargin="20mm" PageRightMargin="20mm" FontType="Subset"  >
            </Pdf>
        </ExportSettings>
        <MasterTableView CommandItemDisplay="Top" DataSourceID="SqlDataSource1" DataKeyNames="masl_id"
            PageSize="4" TableLayout="Fixed">
     
            <CommandItemTemplate>
 <asp:Button ID="DownloadPDF" runat="server" Width="100%" CommandName="ExportToPdf"
 CssClass="pdfButton"></asp:Button>
 
            </CommandItemTemplate>
      
            <Columns>
    
                <telerik:GridTemplateColumn   ItemStyle-ForeColor="Black">
           
                    <ItemTemplate>
                        <table  style="width: 727px; height: 100%" border="0">
                         <colgroup>
                                    <col />
                                    <col />
                                    <col />
                                    <col />
                                    <col />
                                    <col />
                                    <col />
                                </colgroup>
                            <asp:Panel ID="pntest" runat="server" Visible =" true">
                            <tr align="center"  >
                           <%-- style="background-position: center center; width: 1200px; background-image:url('../../images/watermark2.png'); background-repeat: no-repeat;"--%>
                                <td colspan="8">
                                   <b><font size="5" color="black">MASL Detail Report for MASL ID: <%# Eval("masl_id")%></font> </b>
                                 
                                    <br/><br/><br/><br/>
                                </td>
                            </tr>
                            </asp:Panel>
                            <%--<asp:Panel ID="Panel1" runat="server" Visible =" true">--%>
                            <tr align="left" >
                                  <td colspan="8" class="auto-style1">
                                    <asp:Label ID="Label3" runat="server" Text="MASL ID: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <asp:Label ID="Label4" runat="server" Text='<%# Eval("masl_id") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                        <asp:Label ID="Label5" runat="server" Text="Course Title: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <asp:Label ID="Label6" runat="server" Text='<%# Eval("title") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                 
                                     <br/><br/>
                                </td>
                            </tr>
                             <%--</asp:Panel>--%>
                            <tr align="left" >
                                <td colspan="8" class="auto-style1">
                                   
                                     
                                     <asp:Label ID="Label7" runat="server" Text="Effective Date: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label8" runat="server" Text='<%# fDateCheck(DataBinder.Eval(Container.DataItem, "masl_fy").ToString.Trim)%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label9" runat="server" Text="Expiration Date: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label10" runat="server" Text='<%# fDateCheck(DataBinder.Eval(Container.DataItem, "exp_date").ToString.Trim)%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label11" runat="server" Text="Duration: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label12" runat="server" Text='<%# Eval("dur")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>     --%>
                                    
                                     <br/><br/>
                                </td>
                            </tr>

                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                    <asp:Label ID="Label23" runat="server" Text="Course Number: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label24" runat="server" Text='<%# Eval("c_id_no")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Label ID="Label25" runat="server" Text="DSAMS ID: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label26" runat="server" Text='<%# Eval("DSAMS???") %>' Style="font-size: 13px; /*Not sure what this should be*/
                                        color:Black; font-weight: bold;"></asp:Label>   --%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label27" runat="server" Text="IA: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label28" runat="server" Text=' <%# Eval("ia")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label29" runat="server" Text="Security: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label30" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label31" runat="server" Text="E-IMET: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label32" runat="server" Text='<%# Eval("eimet")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>   --%> 
                                    
                                     <br/><br/>
                                </td>
                            </tr>

                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                    <asp:Label ID="Label33" runat="server" Text="Analysis Code: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label34" runat="server" Text='<%# Eval("anal_code")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Label ID="Label35" runat="server" Text="Location Code: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label36" runat="server" Text='<%# Eval("DSAMS???") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>   --%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label37" runat="server" Text="Waiver: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label38" runat="server" Text=' <%# Eval("ia")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label39" runat="server" Text="Team Type: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label40" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                     
                                     <br/><br/>
                                </td>
                            </tr>
                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                    <asp:Label ID="Label41" runat="server" Text="Penalty Rate: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label42" runat="server" Text='<%# Eval("c_id_no")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Label ID="Label43" runat="server" Text="Sensitive: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label44" runat="server" Text='<%# Eval("DSAMS???") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>  --%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label45" runat="server" Text="Phase: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label46" runat="server" Text=' <%# Eval("ia")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label47" runat="server" Text="CDP-ID: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label48" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                     
                                     <br/><br/>
                                </td>
                            </tr>
                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                    <asp:Label ID="Label49" runat="server" Text="Language Requirements: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label50" runat="server" Text='<%# Eval("c_id_no")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Label ID="Label51" runat="server" Text="ECL:" Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label52" runat="server" Text='<%# Eval("DSAMS???") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>   --%>
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label53" runat="server" Text="OPI: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label54" runat="server" Text=' <%# Eval("ia")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label55" runat="server" Text="Set: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                   <%--  <asp:Label ID="Label56" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                     <asp:Label ID="Label57" runat="server" Text="GRE: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label58" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                     
                                     <br/><br/>
                                </td>
                            </tr>

                            <tr align="left" >
                                
                                 <td colspan="7" class="auto-style1">
                                    <asp:Label ID="Label59" runat="server" Text="Course Description: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                    <%-- <asp:Label ID="Label60" runat="server" Text='<%# Eval("c_id_no")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                  
                                   
                                     <br/><br/> <br/><br/> <br/><br/>
                                </td>
                            </tr>
                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                  
                                   
                                       <asp:Label ID="Label61" runat="server" Text="Key Lessons: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label62" runat="server" Text='<%# Eval("DSAMS???") %>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>   --%>
                                    
                                     <br/><br/>
                                </td>
                            </tr>
                              <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                                  
                                     <asp:Label ID="Label63" runat="server" Text="Course Prerequisite Text: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                     <%--<asp:Label ID="Label64" runat="server" Text=' <%# Eval("ia")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label> --%>
                                   
                                   
                                     <br/><br/>
                                </td>
                            </tr>
                            <tr align="left" >
                                 <td colspan="7" class="auto-style1">
                              
                                     <asp:Label ID="Label65" runat="server" Text="International Notes: " Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>
                                   <%--  <asp:Label ID="Label66" runat="server" Text='<%# Eval("Security")%>' Style="font-size: 13px;
                                        color:Black; font-weight: bold;"></asp:Label>--%>
                                   
                                     <br/><br/>
                                </td>
                            </tr>
                       
                        </table>
                    </ItemTemplate>


                </telerik:GridTemplateColumn>
                
            </Columns>
        </MasterTableView>
        <HeaderStyle HorizontalAlign="Center" Font-Size="16px"></HeaderStyle>
        <ItemStyle HorizontalAlign="Left" Font-Names="Arial, Segoe UI, sans-serif;" Font-Size="12px"
            ForeColor="#eeeeee"></ItemStyle>
        <AlternatingItemStyle HorizontalAlign="Left" Font-Names="Arial, Segoe UI, sans-serif;" Font-Size="12px"
            ForeColor="#eeeeee"></AlternatingItemStyle>
    </telerik:RadGrid>

 

Patrick
Top achievements
Rank 1
 asked on 22 May 2017
3 answers
368 views

I'm selecting the initial tab in javascript and while the tab gets selected and the RadPageView gets selected, a postback does not occur to load the page.Clicking on the other tab will load that page and clicking back to the original tab will then load that page as well. Is there another way to select the tab and cause a postback? 

 

Thanks

<%@ Page Language="C#" Inherits="TestPage" CodeBehind="TestPage.aspx.cs" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
 
<head runat="server">
    <title>Title</title>
</head>
<body>
    <form id="form1" runat="server" style="height: 100%">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rtsCCC">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rtsCCC"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="rmpCCC"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
        <telerik:RadTabStrip runat="server" ID="rtsCCC" RenderMode="Lightweight" MultiPageID="rmpCCC" Style="line-height: 0" AutoPostBack="True" OnClientLoad="OnTabStripLoaded">
            <Tabs>
                <telerik:RadTab runat="server" Text="Tab1" Value="t1" />
                <telerik:RadTab runat="server" Text="Tab2" Value="t2" />
            </Tabs>
        </telerik:RadTabStrip>
 
        <telerik:RadMultiPage runat="server" ID="rmpCCC" RenderSelectedPageOnly="True" Height="100%" >
            <telerik:RadPageView runat="server" ID="rpvTab1" Height="100%" Style="overflow: hidden">
                Tab1 content
            </telerik:RadPageView>
 
            <telerik:RadPageView runat="server" ID="rpvTab2" Height="100%" Style="overflow: hidden">
                Tab2 content
            </telerik:RadPageView>
        </telerik:RadMultiPage>
    </form>
 
    <script type="text/javascript">
        var tabStrip = null;
        function OnTabStripLoaded(sender)
        {
            tabStrip = sender;
            setTimeout(function () {
                var tab = tabStrip.findTabByValue("t2");
                tab.select();
            }, 1000);
        }
 
    </script>
</body>
</html>
klac
Top achievements
Rank 1
 answered on 22 May 2017
11 answers
684 views

I have a RadCombobox on an ASP.net page with VB.net code-behind.  There is a RadButton near the RadCombobox that is set up to update the RadCombobox with values from a database table.  When clicking on the RadButton, a query is executed which returns a Dataset of the results and the dataset is used to populate an Array List and the Array List is used as the Data Source for the RadCombobox and then DataBind for RadCombobox is called.

I am using the Array List as the Data Source for the RadCombobox because "ALL" needs to be the first item in the RadCombobox.

I would like to be able to use the RadAjaxLoadingPanel on the RadCombobox and RadButton because the update will take a few minutes and need something to show the user that the update process is running.  With the RadAjaxLoadingPanel  used on the RadButton, it prevents the user from clicking on the RadButton again while the update process is running.

The problem that I am having when using the RadAjaxLoadingPanel is that after the update has completed that the RadCombobox is showing any new values.  I have to refresh the page to get it to show new values.

Please help me to get this to work with the RadAjaxLoadingPanel.  Thanks!

Here is how the AjaxManager is setup:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="False">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rcbbSupplierCode" LoadingPanelID="comboboxLoadingPanel"></telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="rbtnUpdateSuppCodes">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rbtnUpdateSuppCodes" LoadingPanelID="buttonLoadingPanel"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

 

Here is the code for the RadCombobox, RadButton and the Loading Panels:

<telerik:RadAjaxLoadingPanel runat="server" ID="comboboxLoadingPanel"></telerik:RadAjaxLoadingPanel>
<telerik:RadComboBox ID="rcbbSupplierCode" runat="server" MaxHeight="350px" OnClientLoad="textBoxLoadValidCharsOnly" Width="240px" AutoPostBack="true" RenderMode="Lightweight" Filter="StartsWith" MarkFirstMatch="True" EnableTextSelection="true" AllowCustomText="false" onpaste="return false"/>
 
<telerik:RadAjaxLoadingPanel runat="server" ID="buttonLoadingPanel"></telerik:RadAjaxLoadingPanel>
<telerik:RadButton ID="rbtnUpdateSuppCodes" runat="server" Text="Update Supplier Codes" RenderMode="Lightweight">
</telerik:RadButton>

 

Sincerely,

Keith Jackson

Keith
Top achievements
Rank 1
 answered on 22 May 2017
1 answer
89 views

How do I set the data source for a detail table in a hierarchical grid using client side code?

I can see that you can set the master table data source as follows, but how and when do I load the child data into the detail tables?

<script type="text/javascript">
   function pageLoad() {
       var data =
        [
           { "ID": 1, "Text": "Text1" },
           { "ID": 2, "Text": "Text2" }
        ];
       var mtv = $find("RadGrid1").get_masterTableView();
       mtv.set_dataSource(data);
       mtv.dataBind();
   }
</script>

Eyup
Telerik team
 answered on 22 May 2017
1 answer
483 views

hello

i am trying to implement a radgrid with filtering controls; one (or more, hopefully) column should be filtered using a checkbox list

here is the ascx code:

<telerik:RadGrid runat="server" AllowFilteringByColumn="True" FilterType="Combined" DataSourceID="SqlDataSource1"
    AllowPaging="True" PageSize="10" CellSpacing="0" GridLines="None" Skin="Bootstrap" HeaderStyle-Font-Bold="true"
     AutoGenerateColumns="False" ID="subFilesGrid" EnableViewState="true"
        OnPageIndexChanged="subFilesGrid_OnPageIndexChanged"
        onitemcommand="subFilesGrid_ItemCommand" OnFilterCheckListItemsRequested="subFilesGrid_FilterCheckListItemsRequested">
     
<MasterTableView DataKeyNames="nome">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridButtonColumn Text="Download" CommandName="dloadFile" UniqueName="dcCol"></telerik:GridButtonColumn>
        <telerik:GridBoundColumn DataField="originalname" HeaderText="File Name" UniqueName="FileName" HeaderStyle-Width="150px" AllowFiltering="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="dinfo" HeaderText="Description" HeaderStyle-Width="180px" UniqueName="column" AllowFiltering="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="FileType" HeaderText="File Type" HeaderStyle-Width="150px" UniqueName="FileType" FilterCheckListEnableLoadOnDemand="true">
        </telerik:GridBoundColumn>
        <telerik:GridDateTimeColumn DataField="date" HeaderText="Submission Date" HeaderStyle-Width="180px"
            PickerType="DatePicker" FilterDateFormat="yyyy-MM-dd" DataFormatString="{0:yyyy-MM-dd HH:mm}">
        </telerik:GridDateTimeColumn>
        <telerik:GridTemplateColumn DataField="sName" HeaderText="Submitter" UniqueName="column2">
            <ItemTemplate>
                <%# SetSubmitter(Eval("sName"))%>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="status" HeaderText="Status" UniqueName="column3">
            <ItemTemplate>
                <%# SetStatus(Eval("status"))%>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False">
<WebServiceSettings>
<ODataSettings InitialContainerName=""></ODataSettings>
</WebServiceSettings>
</FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
<WebServiceSettings>
<ODataSettings InitialContainerName=""></ODataSettings>
</WebServiceSettings>
</HeaderContextMenu>
     
</telerik:RadGrid>

 and here is code-behind for filling the checkbox list

protected void subFilesGrid_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
        {
            string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
            e.ListBox.Items.Clear();
            e.ListBox.AppendDataBoundItems = false;
            /*e.ListBox.DataSource = GetDataTable(DataField);
            e.ListBox.DataKeyField = DataField;
            e.ListBox.DataTextField = DataField;
            e.ListBox.DataValueField = DataField;
            e.ListBox.DataBind();*/
            string query = "SELECT type as FileType FROM [ICOS].[dbo].[FileType] where id_filetype!=20";
            // string.Format("SELECT type as FileType FROM [ICOS].[dbo].[FileType] where id_filetype!=20", field);
 
            SqlConnection cn = new SqlConnection(conn);
            cn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
            cmd.CommandText = query;
            SqlDataReader rd = cmd.ExecuteReader();
            while (rd.Read())
            {
                e.ListBox.Items.Add(new RadListBoxItem(rd["FileType"].ToString()));
            }
            e.ListBox.DataTextField = DataField;
            e.ListBox.DataValueField = DataField;
            e.ListBox.DataBind();
            rd.Close();
            cn.Close();
            e.ListBox.ShowCheckAll = false;
             
        }

now, when loading the page, an unexpected item is displayed: ResourceNotFound#CheckListBox:CheckAll (you can see it here)

i have followed the steps showed in this page

Thanx in advance

Diego

Eyup
Telerik team
 answered on 22 May 2017
1 answer
156 views

Hello, can you convert this code into client side binding?

 

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyNamespaceGrid.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title id="HTMLTITLE">Default</title>

    <link href="/CSS/jquery-ui.min.css" type="text/css" rel="stylesheet" media="screen" />
    <link href="/CSS/jquery-ui.structure.min.css" type="text/css" rel="stylesheet" media="screen" />
    <link href="/CSS/jquery-ui.theme.min.css" type="text/css" rel="stylesheet" media="screen" />
    <script src="/CSS/jquery-1.4.2.min.js"></script>

    <style type="text/css">
        .HeaderGrey {
            background-color: #939da2 !important;
            background-image: none !important;
            color: White !important;
            border-right: 1px solid white !important;
            font-weight: bold !important;
            padding-top: 10px !important;
            padding-bottom: 10px !important;
        }

        .SubHeaderGrey {
            background-color: #A9B4B9 !important;
            background-image: none !important;
            color: White !important;
            border-right: 1px solid white !important;
            font-weight: bold !important;
        }

        .HeaderGreyNoBorder {
            background-color: #939da2 !important;
            background-image: none !important;
            color: White !important;
            font-weight: bold !important;
            padding-top: 10px !important;
            padding-bottom: 10px !important;
        }

        .SubHeaderGreyNoBorder {
            background-color: #A9B4B9 !important;
            background-image: none !important;
            color: White !important;
            font-weight: bold !important;
            border-right: 1px solid #A9B4B9 !important;
        }

        .BlueText {
            color: Blue !important;
        }

        .rgPager, .rgPager a {
            font-family: Verdana, Helvetica, Arial, sans-serif !important;
        }

        .rgWrap {
            font-family: Verdana, Helvetica, Arial, sans-serif !important;
        }

        div.RadGrid .rgRow td,
        div.RadGrid .rgAltRow td {
            padding: 5px;
        }

        .RadGrid_Default .rgMasterTable td.rgGroupCol, .RadGrid_Default .rgMasterTable td.rgExpandCol {
            border-color: white !important;
            background: white none !important;
        }

        .rgDetailTable {
            border: none !important;
        }

        .rgCollapse {
            background-image: url('/CSS/Images/ui-icons_469bdd_256x240minus.png') !important;
            background-position: 0px 0px !important;
        }

        .rgExpand {
            background-image: url('/CSS/Images/ui-icons_469bdd_256x240plus.png') !important;
            background-position: 0px 0px !important;
        }
    </style>
    <script type="text/javascript">
        function AddArrowIcons(sender, args) {
            var column = args.get_column();
            switch (column.get_uniqueName()) {
                case "ExpandColumn":
                    break;
                default:
                    column
                    .get_element()
                    .innerHTML +=
                    "&nbsp;&nbsp;<span class=\"ui-icon ui-icon-triangle-2-n-s\" style=\"float:right;-webkit-transform: scale(2);-ms-transform: scale(2);background-image: url(/CSS/images/ui-icons_ffffff_256x240.png)\"></span>"; //setting new HeaderText
                    break;
            }
        }
    </script>
</head>

<body>
    <form id="form1" runat="server">
        <div style="padding-left: 0px">
            <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>

            <table>
                <tr>
                    <td>Person Type:</td>
                    <td>
                        <asp:DropDownList runat="server" Width="175px" ID="ddlPersonType">
                            <asp:ListItem Selected="True" Value="Parent">Parent</asp:ListItem>
                            <asp:ListItem Value="SubAccount">Sub Account</asp:ListItem>
                            <asp:ListItem Value="Individual">Individual</asp:ListItem>
                        </asp:DropDownList></td>
                </tr>
                <tr>
                    <td>SIN Number - last 4 digits:</td>
                    <td>******<asp:TextBox runat="server" ID="txtSINNumber" MaxLength="4" Width="90px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Name on Account:</td>
                    <td>
                        <asp:TextBox runat="server" ID="txtName" Width="175px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Staus:</td>
                    <td>
                        <asp:DropDownList runat="server" Width="175px" ID="ddlStatus">
                            <asp:ListItem Selected="True" Value="All"> All </asp:ListItem>
                            <asp:ListItem Value="Normal">Normal</asp:ListItem>
                            <asp:ListItem Value="Expired">Expired</asp:ListItem>
                        </asp:DropDownList></td>
                </tr>

                <tr>
                    <td>
                        <asp:Button ID="btnFilter" Text="Filter" runat="server" OnClick="btnFilter_OnClick" class="btn110x21" />
                    </td>
                    <td>
                        <span class="ui-icon ui-icon-close" style="float: left; background-image: url(/CSS/images/ui-icons_222222_256x240.png)"></span>
                        <asp:LinkButton runat="server" ID="btnClearFilter" OnClick="btnClearFilter_OnClick" Text="Reset"></asp:LinkButton></td>
                </tr>
            </table>


            <div style="padding-top: 10px">
                <telerik:RadGrid ID="RadGrid2" runat="server" Width="1100px"
                    OnDetailTableDataBind="RadGrid1_DetailTableDataBind" AutoGenerateColumns="False" ShowStatusBar="False" PageSize="3"
                    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" GridLines="None" OnItemDataBound="RadGrid2_OnItemDataBound" AllowCustomPaging="False">
                    <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" PageSizeControlType="RadComboBox"></PagerStyle>
                    <MasterTableView HierarchyLoadMode="ServerBind" DataKeyNames="ParentAccountID,SinNumber,PersonType" Name="Parent" ExpandCollapseColumn-Display="false"
                        Font-Names="Verdana,Helvetica,Arial, sans-serif" Font-Size="12px">
                        <Columns>
                            <telerik:GridExpandColumn UniqueName="ExpandColumn" HeaderStyle-CssClass="HeaderGreyNoBorder"></telerik:GridExpandColumn>
                            <telerik:GridBoundColumn HeaderText="Person Type" HeaderButtonType="TextButton"
                                DataField="PersonType" UniqueName="PersonType" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="HeaderGrey">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn SortExpression="SinNumber" HeaderText="SIN Number" HeaderButtonType="TextButton"
                                UniqueName="SinNumber" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="HeaderGrey">
                                <ItemTemplate>
                                    <asp:HyperLink runat="server" ID="HyperLink2" CssClass="BlueText" Text='<%# Eval("SinNumber") %>' NavigateUrl="Demo.aspx">   
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn SortExpression="ParentAccountID" HeaderText="ParentAccountID" HeaderButtonType="TextButton"
                                DataField="ParentAccountID" UniqueName="ParentAccountID" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="AccountHolderName" HeaderText="Name" HeaderButtonType="TextButton"
                                DataField="AccountHolderName" UniqueName="AccountHolderName" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="HeaderGrey">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton"
                                DataField="Status" UniqueName="Status" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="HeaderGrey">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="AccountHolderName"></telerik:GridSortExpression>
                        </SortExpressions>

                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="ParentAccountID,SinNumber,PersonType" Font-Names="Verdana,Helvetica,Arial, sans-serif" Font-Size="12px">
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="PersonType" HeaderText="Person Type" HeaderButtonType="TextButton"
                                        DataField="PersonType" UniqueName="PersonType" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="SubHeaderGrey" HeaderStyle-Width="160px">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn SortExpression="SinNumber" HeaderText="SIN Number" HeaderButtonType="TextButton"
                                        UniqueName="SinNumber" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="SubHeaderGrey">
                                        <ItemTemplate>
                                            <asp:HyperLink runat="server" ID="HyperLink1" CssClass="BlueText" Text='<%# Eval("SinNumber") %>' NavigateUrl="Demo.aspx">   
                                            </asp:HyperLink>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn SortExpression="ParentAccountID" HeaderText="ParentAccountID" HeaderButtonType="TextButton"
                                        DataField="ParentAccountID" UniqueName="ParentAccountID" Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="AccountHolderName" HeaderText="Name" HeaderButtonType="TextButton"
                                        DataField="AccountHolderName" UniqueName="AccountHolderName" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="SubHeaderGrey">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton"
                                        DataField="Status" UniqueName="Status" ItemStyle-HorizontalAlign="Left" HeaderStyle-CssClass="SubHeaderGrey">
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <SortExpressions>
                                    <telerik:GridSortExpression FieldName="AccountHolderName"></telerik:GridSortExpression>
                                </SortExpressions>
                            </telerik:GridTableView>
                        </DetailTables>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents OnColumnCreated="AddArrowIcons" />
                    </ClientSettings>
                </telerik:RadGrid>
            </div>
        </div>
    </form>
</body>
</html>

 

Default.aspx.cs:

 

using System;
using System.Collections.Generic;
using System.Linq;
using Telerik.Web.UI;

namespace MyNamespaceGrid
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var accounts = GetFitleredAccounts();
            RadGrid2.DataSource = accounts;
        }

        protected void RadGrid2_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Parent")
            {
                GridDataItem item = (GridDataItem)e.Item;
                if (item.GetDataKeyValue("PersonType").ToString() == "Individual")
                {
                    (item["ExpandColumn"].Controls[0]).Visible = false;
                }
            }
        }

        protected void btnFilter_OnClick(object sender, EventArgs e)
        {
            RadGrid2.DataSource = GetFitleredAccounts();
            RadGrid2.Rebind();
        }

        protected void btnClearFilter_OnClick(object sender, EventArgs e)
        {
            txtSINNumber.Text = "";
            txtName.Text = "";
            ddlStatus.SelectedIndex = 0;
            ddlPersonType.SelectedIndex = 0;

            var accounts = GetAccounts();
            RadGrid2.DataSource = accounts;
            RadGrid2.Rebind();
        }

        protected void RadGrid1_DetailTableDataBind(object sende, GridDetailTableDataBindEventArgs e)
        {
            if (e.DetailTableView.ParentItem.DataItem == null)
            {
                int ParentAccountId = (int)e.DetailTableView.ParentItem.GetDataKeyValue("ParentAccountID");
                List<ParentAccount> row = (List<ParentAccount>)e.DetailTableView.DataSource;
                ParentAccount r = row.Where(z => z.ParentAccountID == ParentAccountId).FirstOrDefault();
                e.DetailTableView.DataSource = r.SubAccounts;
            }
            else
                e.DetailTableView.DataSource = ((ParentAccount)e.DetailTableView.ParentItem.DataItem).SubAccounts;
        }
        private List<ParentAccount> GetFitleredAccounts()
        {
            var accounts = GetAccounts();

            // is there a better way to initalize this
            var result = accounts.Where(s => s.ParentAccountID != null);

            #region Parent Filter

            if (ddlPersonType.Text == "Parent")
            {
                result = accounts.Where(s => s.PersonType == "Parent");

                if (!string.IsNullOrEmpty(txtSINNumber.Text))
                {
                    result = result.Where(s => s.SinNumber.EndsWith(txtSINNumber.Text));
                }
                if (!string.IsNullOrEmpty(txtName.Text))
                {
                    result = result.Where(s => s.AccountHolderName.ToUpper().Contains(txtName.Text.ToUpper()));
                }
                if (ddlStatus.SelectedIndex != 0)
                {
                    result = result.Where(s => s.Status == ddlStatus.Text);
                }
                return result.ToList();
            }

            #endregion

            #region Individual Filter

            if (ddlPersonType.Text == "Individual")
            {
                result = accounts.Where(s => s.PersonType == "Individual");

                if (!string.IsNullOrEmpty(txtSINNumber.Text))
                {
                    result = result.Where(s => s.SinNumber.EndsWith(txtSINNumber.Text));
                }
                if (!string.IsNullOrEmpty(txtName.Text))
                {
                    result = result.Where(s => s.AccountHolderName.ToUpper().Contains(txtName.Text.ToUpper()));
                }
                if (ddlStatus.SelectedIndex != 0)
                {
                    result = result.Where(s => s.Status == ddlStatus.Text);
                }
                return result.ToList();
            }

            #endregion

            #region Sub Account Filter

            if (ddlPersonType.Text == "SubAccount")
            {
                //inital dataset based on account type
                var resultList = accounts.Where(t => t.SubAccounts != null).ToList();

                if (!string.IsNullOrEmpty(txtSINNumber.Text))
                {

                    // Remove items for the parent table
                    for (int i = resultList.Count() - 1; i >= 0; i--)
                    {
                        bool foundMatch = false;

                        if (resultList[i].SubAccounts != null)
                        {
                            foreach (var sub in resultList[i].SubAccounts)
                            {
                                if (sub.SinNumber.EndsWith(txtSINNumber.Text))
                                {
                                    foundMatch = true;
                                }
                            }
                        }

                        if (foundMatch == false)
                            resultList.Remove(resultList[i]);
                    }

                    //filter child list
                    resultList.ForEach(
                        c => c.SubAccounts.RemoveAll(i => !i.SinNumber.EndsWith(txtSINNumber.Text)));

                    return resultList;
                }
                if (!string.IsNullOrEmpty(txtName.Text))
                {
                    // Remove items for the parent table
                    for (int i = resultList.Count() - 1; i >= 0; i--)
                    {
                        bool foundMatch = false;

                        if (resultList[i].SubAccounts != null)
                        {
                            foreach (var sub in resultList[i].SubAccounts)
                            {
                                if (sub.AccountHolderName.ToUpper().Contains(txtName.Text.ToUpper()))
                                {
                                    foundMatch = true;
                                }
                            }
                        }

                        if (foundMatch == false)
                            resultList.Remove(resultList[i]);
                    }

                    //filter child list
                    resultList.ForEach(
                        c =>
                            c.SubAccounts.RemoveAll(
                                i => !i.AccountHolderName.ToUpper().Contains(txtName.Text.ToUpper())));

                    return resultList;
                }
                if (ddlStatus.SelectedIndex != 0)
                {
                    // Remove items for the parent table
                    for (int i = resultList.Count() - 1; i >= 0; i--)
                    {
                        bool foundMatch = false;

                        if (resultList[i].SubAccounts != null)
                        {
                            foreach (var sub in resultList[i].SubAccounts)
                            {
                                if (sub.Status == ddlStatus.Text)
                                {
                                    foundMatch = true;
                                }
                            }
                        }

                        if (foundMatch == false)
                            resultList.Remove(resultList[i]);
                    }

                    //filter child list
                    resultList.ForEach(c => c.SubAccounts.RemoveAll(i => i.Status != ddlStatus.Text));

                    return resultList;
                }
            }

            #endregion

            return accounts;

        }

        private List<ParentAccount> GetAccounts()
        {

            #region Hardcoded data

            List<ParentAccount> accounts = new List<ParentAccount>
            {
                new ParentAccount
                {
                    ParentAccountID = 2,
                    PersonType = "Individual",
                    AccountHolderName = "Grace Nix",
                    SinNumber = "7501",
                    Status = "Normal"
                },

                new ParentAccount
                {
                    ParentAccountID = 3,
                    PersonType = "Parent",
                    AccountHolderName = "Andrew Mill",
                    SinNumber = "7535",
                    Status = "Normal",
                    SubAccounts = new List<SubAccount>
                    {
                        new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Joe Danny",
                            SinNumber = "7600",
                            Status = "Normal"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Chris Robminson",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                        ,new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Alex Fisher",
                            SinNumber = "7600",
                            Status = "Normal"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Mark Reece",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                        ,
                        new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Dale Morison",
                            SinNumber = "7600",
                            Status = "Expired"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 3,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Rob Mason",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                    }
                }

                ,
                new ParentAccount
                {
                    ParentAccountID = 4,
                    PersonType = "Parent",
                    AccountHolderName = "Wes Allman",
                    SinNumber = "7501",
                    Status = "Normal",
                    SubAccounts = new List<SubAccount>
                    {
                        new SubAccount
                        {
                            ParentAccountID = 4,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Gin Un",
                            SinNumber = "2222",
                            Status = "Normal"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 4,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Mick Colt",
                            SinNumber = "3333",
                            Status = "Expired"
                        }
                    }
                },

                new ParentAccount
                {
                    ParentAccountID = 6,
                    PersonType = "Parent",
                    AccountHolderName = "Tracy Anderson",
                    SinNumber = "7535",
                    Status = "Expired",
                    SubAccounts = new List<SubAccount>
                    {
                        new SubAccount
                        {
                            ParentAccountID = 6,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Jon Wex",
                            SinNumber = "7600",
                            Status = "Expired"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 6,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Ruan Juan",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                    }
                },
                new ParentAccount
                {
                    ParentAccountID = 18,
                    PersonType = "Parent",
                    AccountHolderName = "Marie Wilson",
                    SinNumber = "3333",
                    Status = "Normal",
                    SubAccounts = new List<SubAccount>
                    {
                        new SubAccount
                        {
                            ParentAccountID = 18,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Ron Ottan",
                            SinNumber = "7600",
                            Status = "Normal"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 18,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Will Naw",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                    }
                },
                new ParentAccount
                {
                    ParentAccountID = 19,
                    PersonType = "Parent",
                    AccountHolderName = "Dan Can",
                    SinNumber = "7535",
                    Status = "Normal",
                    SubAccounts = new List<SubAccount>
                    {
                        new SubAccount
                        {
                            ParentAccountID = 19,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Esther Cran",
                            SinNumber = "3333",
                            Status = "Normal"
                        },
                        new SubAccount
                        {
                            ParentAccountID = 19,
                            SubAccountID = 12,
                            PersonType = "Sub Account",
                            AccountHolderName = "Paul Max",
                            SinNumber = "7626",
                            Status = "Normal"
                        }
                    }
                }
            };

            #endregion
            return accounts;
        }
    }

    public class ParentAccount
    {
        public int ParentAccountID { get; set; }
        public string PersonType { get; set; }
        public string SinNumber { get; set; }
        public string AccountHolderName { get; set; }
        public string Status { get; set; }

        public List<SubAccount> SubAccounts;
    }

    public class SubAccount
    {
        public int SubAccountID { get; set; }
        public int ParentAccountID { get; set; }
        public string PersonType { get; set; }
        public string SinNumber { get; set; }
        public string AccountHolderName { get; set; }
        public string Status { get; set; }

    }

}

Eyup
Telerik team
 answered on 22 May 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?