This is a migrated thread and some comments may be shown as answers.

RadGrid filters do not work when lazy loading

2 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amod
Top achievements
Rank 1
Amod asked on 11 Mar 2016, 04:24 AM

Hi,

I have a radgrid bound to serverside datasource. It is configured for delayed loading and that works like a charm.I have column filters on the rad-grid. But
after coding for lazy loading the filter has stopped working. No request is triggered to the server when I type text in the filter textbox. I tried all the filter specific options on the grid and column. If I comment the 'lazy loading' code the filters start working again. I am guessing the control IDs getting changed somewhere?

Code pasted below for your reference. Please help.

Thank You

ASPX Javascript

<telerik:RadCodeBlock runat="server">
    <script type="text/javascript">
        var isInitialLoad = true;
         
        function pageLoad(sender, args)
        {
            if (isInitialLoad)
            {
                isInitialLoad = false;
 
                setTimeout(function()
                {
                    var manager = $find('<%= ramManager.ClientID %>');
                    manager.ajaxRequest("BindTerms");
                }, 1000);
            }
        }
    </script>
</telerik:RadCodeBlock>

 

ASPX Grid

<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
 
        <telerik:RadAjaxManager runat="server" ID="ramManager">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID = "ramManager">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
                            LoadingPanelID="pnlLoading"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
                            LoadingPanelID="pnlLoading"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="btnAddOpportunity">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
                            LoadingPanelID="pnlLoading" />
                        <telerik:AjaxUpdatedControl ControlID="msgPlaceHolder" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="lnkAddNew">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
                            LoadingPanelID="pnlLoading" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
       <telerik:RadAjaxLoadingPanel ID="pnlLoading" runat="server" meta:resourcekey="pnlLoadingResource1"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="pnlLoading">    
            <div id="popup">
                <div id="msgPlaceHolder" runat="server" />
                <table style="width: 100%">
                    <tr>
                        <td>
                            <div>
                                <telerik:RadGrid
                                    runat="server"
                                    AutoGenerateColumns="false"
                                    OnNeedDataSource="grdPTerms_NeedDataSource"
                                    AllowFilteringByColumn="true"
                                    ID="grdPTerms">
                                    <ClientSettings>
                                        <Scrolling
                                            AllowScroll="True"
                                            UseStaticHeaders="True"
                                            SaveScrollPosition="true"
                                            ScrollHeight="290px"></Scrolling>
                                    </ClientSettings>
                                    <MasterTableView>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="AMAR"
                                                Name="Amar"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="My Report License"
                                                Name="MYReportLicense"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="Demo Pack"
                                                Name="DemoPack"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="POC Pack"
                                                Name="POCPack"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="Quick Service"
                                                Name="QuickService"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
                                        <ColumnGroups>
                                            <telerik:GridColumnGroup
                                                HeaderText="VirtDB License"
                                                Name="VirtDB"
                                                HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridColumnGroup>
                                        </ColumnGroups>
 
                                        <Columns>
                                            <telerik:GridBoundColumn
                                                DataField="i_id"
                                                UniqueName="i_id"
                                                Display="false"
                                                HeaderText="ID"></telerik:GridBoundColumn>
 
                                            <telerik:GridBoundColumn
                                                DataField="i_partner_id"
                                                UniqueName="i_partner_id"
                                                Display="false"
                                                HeaderText="ID"></telerik:GridBoundColumn>
                                             
                                            <telerik:GridBoundColumn
                                                DataField="s_partner"
                                                AllowFiltering="true"
                                                CurrentFilterFunction="Contains"
                                                FilterDelay="1000"
                                                HeaderText="Name"
                                                HeaderStyle-Width="110px">
                                            </telerik:GridBoundColumn>
 
                                            <telerik:GridTemplateColumn
                                                HeaderText="Advance"
                                                ColumnGroupName="Amar"
                                                AllowFiltering="false"
                                                UniqueName="ColMyAmarAdvance"
                                                HeaderStyle-Width="55px">
                                                <ItemTemplate>
                                                    <telerik:RadNumericTextBox ID='t_am_poapproved'
                                                        runat="server" MaxLength="2"
                                                        NumberFormat-DecimalDigits="0"
                                                        Text='<%# Bind("am_poapproved")%>'
                                                        Width="40px"
                                                        EnabledStyle-HorizontalAlign="Right">
                                                    </telerik:RadNumericTextBox>
                                                    <span>%</span>
                                                    <span style="color: red; font-size: 12px; font-weight: bold">*</span>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn
                                                HeaderText="License Approval"
                                                ColumnGroupName="Amar"
                                                AllowFiltering="false"
                                                UniqueName="ColAmarFinal"
                                                HeaderStyle-Width="50px">
                                                <ItemTemplate>
                                                    <telerik:RadNumericTextBox ID="t_am_final"
                                                        runat="server" MaxLength="2"
                                                        NumberFormat-DecimalDigits="0"
                                                        Text='<%# Bind("am_final")%>'
                                                        Width="40px"
                                                        EnabledStyle-HorizontalAlign="Right">
                                                    </telerik:RadNumericTextBox>
                                                    <span>%</span>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <GroupingSettings CaseSensitive="false" />
                                </telerik:RadGrid>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </telerik:RadAjaxPanel>
    </form>
</body>

Irrelevant code is removed.

 

Code Behind

protected void Page_Load(object sender, EventArgs e)
{
    ramManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest);
}
 
void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    if (e.Argument == "BindTerms")
    {
        grdPTerms.Rebind();
    }
}
 
protected void grdPTerms_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    if (Page.IsPostBack)
    {
        List<Partner> pList = (List<Partner>)Application["QRPartner"];
        SrvPaymentTerm srvPT = new SrvPaymentTerm();
 
        DataTable dt = srvPT.Select(pList);
        grdPTerms.DataSource = dt;
    }
    else
    {
        DataTable dt = new DataTable();
        grdPTerms.DataSource = dt;
    }
}

2 Answers, 1 is accepted

Sort by
0
Amod
Top achievements
Rank 1
answered on 11 Mar 2016, 04:33 AM

Is this something to do with the ajax manager not configured correctly? I have input text boxes in the grid. If lazy loading is uncommented I do not get the changed textbox values on the server either.

0
Viktor Tachev
Telerik team
answered on 11 Mar 2016, 02:26 PM
Hello Amod,

I have examined the code and noticed that you are using both RadAjaxManager and RadAjaxPanel controls. Moreover the RadAjaxPanel is added to the AjaxSettings of RadAjaxManager. Note that this is not a supported scenario as it can Ajax-enable the controls multiple times.

It is recommended to use only one control for Ajax-ifying. As the RadAjaxManager is more versatile I would recommend sticking with it. Then replace the RadAjaxPanel with a regular Panel control and see how the behavior changes.

Furthermore, in order to test if the issue is Ajax-related you can temporarily disable AJAX. To do this you should set the EnableAjax property of RadAjaxManager to false.

Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Amod
Top achievements
Rank 1
Answers by
Amod
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or