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

Paging not working with custom filtering

5 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Naresh Goradara
Top achievements
Rank 2
Naresh Goradara asked on 30 Jun 2010, 10:22 AM

Hi,
I am using ASP.Net RadControls -Q1 2010 for development.
I am using ColumnFilteringColumn class for filtering.
This working fine without paging, if I select any filtering and click on paging then this displays all record without filtering but just keep selection no actual filtering.

Please suggest any modification for below class for filtering.

public class CustomFilteringColumn : GridTemplateColumn  
    {  
        private GridKnownFunction gridKnownFunction;  
        /// <summary>  
        /// Get Set Filter Function  
        /// Predefined filter expression enumaration. Used by CustomFilteringColumn class.  
        /// </summary>  
        public GridKnownFunction FilterFunction  
        {  
            get { return gridKnownFunction; }  
            set { gridKnownFunction = value; }  
        }  
        private String uniqueId;  
        public String UniqueId  
        {  
            get { return uniqueId; }  
            set { uniqueId = value; }  
        }  
 
        public CustomFilteringColumn()  
        {  
            //  
            // TODO: Add constructor logic here  
            //  
        }  
        public DataTable GetDataTable(string strHeaderText)  
        {  
               return new DataTable();//external source...here  
        }  
 
        protected override void SetupFilterControls(TableCell cell)  
        {  
            base.SetupFilterControls(cell);  
            Object obj = cell.Controls[0];  
            cell.Controls.RemoveAt(0);  
            RadComboBox list = new RadComboBox();  
            list.ID = "list" + this.DataField;  
            list.Width = Unit.Percentage(100);  
            list.AutoPostBack = true;  
 
            list.ValidationGroup = this.CurrentFilterFunction.ToString();  
            list.SelectedIndexChanged += rcBox_SelectedIndexChanged;  
 
            DataTable table = GetDataTable(this.DataField);  
            DataRow row = table.NewRow();  
            row[this.DataField] = "All";  
            table.Rows.InsertAt(row, 0);  
            list.DataSource = table;  
            cell.Controls.AddAt(0, list);  
            cell.Controls.RemoveAt(1);  
            list.DataTextField = this.DataField;  
            list.DataValueField = this.DataField;  
        }  
        protected override void SetCurrentFilterValueToControl(TableCell cell)  
        {  
            base.SetCurrentFilterValueToControl(cell);  
            RadComboBox list = (RadComboBox)cell.Controls[0];  
            list.Items[0].Value = Resources.GeneralMessages.DefaultValue;  
            if (this.CurrentFilterValue != string.Empty)  
            {  
                list.SelectedValue = this.CurrentFilterValue;  
 
                //GridFilteringItem filterItem = list.NamingContainer as GridFilteringItem;  
                //filterItem.FireCommandEvent("Filter", new Pair(gridKnownFunction.ToString(), this.UniqueName));  
                rcBox_SelectedIndexChanged(list, new RadComboBoxSelectedIndexChangedEventArgs(""""""""));  
            }  
        }  
 
        protected override string GetCurrentFilterValueFromControl(TableCell cell)  
        {  
            RadComboBox list = (RadComboBox)cell.Controls[0];  
            if (list.SelectedValue == Resources.GeneralMessages.DefaultValue)  
                return String.Empty;  
            return list.SelectedValue;  
        }  
 
        private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)  
        {  
            GridFilteringItem filterItem = (sender as RadComboBox).NamingContainer as GridFilteringItem;  
            filterItem.FireCommandEvent("Filter"new Pair(gridKnownFunction.ToString(), this.UniqueName));  
 
        }  
 
    } 


<%@ Register TagPrefix="custom" Namespace="FilteringTemplateColumns" %> 
 
-----------------------------  
<custom:CustomFilteringColumn DataField="strCustomerTypeDefault" SortExpression="strCustomerTypeDefault" 
                                                                    HeaderText="Customer Type" FilterFunction="Contains" UniqueName="strCustomerTypeDefault">  
                                                                    <ItemTemplate> 
                                                                        <%# Eval("strCustomerTypeDefault")%> 
                                                                    </ItemTemplate> 
                                                                </custom:CustomFilteringColumn> 

Thanks in advance,
Naresh Goradara

Thanks in advance,Naresh Goradara

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 30 Jun 2010, 02:00 PM
Hello Naresh,

In the following online example you could find implementation of this approach:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx

Check it out and let me know if it helps to resolve the problem you are facing.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Naresh Goradara
Top achievements
Rank 2
answered on 02 Jul 2010, 06:14 AM
Hi Pavlina,
Thank you for your replay.
I have tried with your given link, but the problem not resolved in special scenario...
In normal environment it works fine, but the problem occurs only after generating local resources. If I try by just removing the resource key for grid then it works fine. But removing resource key - creates issue in localization for Command Menu -"Add new record".

Please suggest any idea to overcome this issue.

WIth Regards,
Naresh Goradara
0
Pavlina
Telerik team
answered on 02 Jul 2010, 01:41 PM
Hi Naresh,

At this point in order to progress in the resolution of this matter it will be best if you open a regular support ticket and send us a simple working project, demonstrating the issue. Thus we could review it locally and advice you further.

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Naresh Goradara
Top achievements
Rank 2
answered on 06 Jul 2010, 08:05 AM
Hi Pavlina,
I have sent open new support ticket before two days, but still I am not getting any type of replay from your end.
Please suggest.

With Regards,
Naresh Goradara
0
Pavlina
Telerik team
answered on 06 Jul 2010, 03:16 PM
Hello Naresh,

Please, refer to the support ticket post for additional information. In order to avoid duplicate posts, we can continue our communication there.

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Naresh Goradara
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Naresh Goradara
Top achievements
Rank 2
Share this question
or