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

Radgrid filtering doesn't work when i use RadAjaxLoadingPanel

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mariam
Top achievements
Rank 1
Mariam asked on 17 Jan 2013, 08:05 AM
hello, i try to use RadAjaxLoadingPanel , but rad grid column filters down't work . here is my code samples
p.s im using user control

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ACMSGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ACMSGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
      
        </AjaxSettings>
    </telerik:RadAjaxManager>
    
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
  
<%--OnPreRender="ACMSGrid_PreRender"--%>
<telerik:RadGrid ID="ACMSGrid" runat="server" OnNeedDataSource="ACMSGrid_NeedDataSource"
    AllowFilteringByColumn="True" AllowPaging="True" OnItemDataBound="ACMSGrid_ItemDataBound"
    AllowSorting="True" CellSpacing="0" EnableLinqExpressions="false"
   OnPreRender="ACMSGrid_PreRender"
    GridLines="None" AutoGenerateColumns="False">
    <MasterTableView AllowFilteringByColumn="True">
        <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>
 
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
        <Columns>
            <telerik:GridBoundColumn DataField="ACMS_Number" HeaderText="ნომერი"
                SortExpression="ACMS_Number" UniqueName="ACMS_Number" FilterControlWidth="40px"
                AutoPostBackOnFilter="False" CurrentFilterFunction="Contains"
                FilterDelay="1000" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
 
            <telerik:GridDateTimeColumn DataField="ACMS_Date" SortExpression="ACMS_Date" HeaderText="თარიღი"
                UniqueName="ACMS_Date" CurrentFilterFunction="Contains" DataFormatString="{0:dd.MM.yyyy}"
                AutoPostBackOnFilter="True" FilterDelay="4000" ShowFilterIcon="false">
            </telerik:GridDateTimeColumn>
 
            <telerik:GridHyperLinkColumn AllowFiltering="false" DataTextFormatString="pdf '{0}'"
                DataNavigateUrlFields="id" UniqueName="id" DataNavigateUrlFormatString="~/common/ACMS_get_doc.aspx?id={0}"
                HeaderText="დოკუმენტი" DataTextField="id">
            </telerik:GridHyperLinkColumn>
 
            <telerik:GridBoundColumn DataField="ACMS_Type" HeaderText="ტიპი" HeaderStyle-Width="350px"
                SortExpression="ACMS_Type" UniqueName="ACMS_Type">
                <FilterTemplate>
                    <telerik:RadComboBox runat="server" ID="FilterCombo" DataSourceID="SqlDataSource3"
                        DataValueField="ACMS_Type" DataTextField="ACMS_Type" AutoPostBack="true"  AppendDataBoundItems="true"
                        SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ACMS_Type").CurrentFilterValue %>'
                        OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged">
                            <Items>
                                  <telerik:RadComboBoxItem Text="" />
                                
                            </Items>
                    </telerik:RadComboBox>
 
              
 
      <asp:Button ID="btnShowAll" runat="server" OnClick="btnShowAll_Click" Text="ფილტრის გასუფთავება" />
              
                </FilterTemplate>
            </telerik:GridBoundColumn>
        </Columns>
 
    </MasterTableView>
    <ClientSettings>
        <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
            AllowColumnResize="True"></Resizing>
 
    </ClientSettings>
    <HeaderStyle Width="250px"></HeaderStyle>
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
 
<asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:db_conn %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT  ACMS_type FROM itdc_ACMS_type"
    runat="server"></asp:SqlDataSource>

and here is codebehind

protected void Page_Load(object sender, EventArgs e)
   {
 
       acms get_data = new acms();
       ACMSGrid.DataSource = get_data.get_ACMS();
       ACMSGrid.DataBind();
   }
 
   protected void ACMSGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
   {
       acms get_data = new acms();
       ACMSGrid.DataSource = get_data.get_ACMS();
       ACMSGrid.DataBind();
   }
 
   protected void ACMSGrid_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem item = (GridDataItem)e.Item;
           HyperLink hyplnk = (HyperLink)item["id"].Controls[0];
           hyplnk.ImageUrl = "~/m/i/pdf.gif";
       }
   }
 
 
 
   protected void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
   {
       string filterExpression;
       filterExpression = "([ACMS_type] = '" + e.Value + "')";
       ACMSGrid.MasterTableView.FilterExpression = filterExpression;
       ACMSGrid.MasterTableView.Rebind();
   }
   protected void ACMSGrid_PreRender(object sender, System.EventArgs e)
   {
 
 
       foreach (GridFilteringItem filterItem in ACMSGrid.MasterTableView.GetItems(GridItemType.FilteringItem))
       {
           RadComboBox dropdown = (RadComboBox)filterItem.FindControl("FilterCombo");
 
           //Response.Write(dropdown.SelectedValue);
           if (dropdown.SelectedValue == "All")
           {
               RefreshCombos();
           }
           else
           {
 
           }
       }
   }
 
   protected void RefreshCombos()
   {
        
       ACMSGrid.MasterTableView.FilterExpression = string.Empty;
 
       ACMSGrid.MasterTableView.Rebind();
   }
 
   protected void btnShowAll_Click(object sender, EventArgs e)
   {
       ACMSGrid.MasterTableView.FilterExpression = string.Empty;
 
       foreach (GridColumn column in ACMSGrid.MasterTableView.RenderColumns)
       {
           if (column is GridBoundColumn)
           {
               GridBoundColumn boundColumn = column as GridBoundColumn;
               boundColumn.CurrentFilterValue = string.Empty;
           }
       }
 
       ACMSGrid.MasterTableView.Rebind();
 
   }

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 18 Jan 2013, 04:45 PM
Hello,

Does the problem with grid filtering persists only when RadGrid is Ajaxified? If you disable ajax by setting EnableAjax property to false, is there are any difference.

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Mariam
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or