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

Populate Filtering Drop-down on Grid using values in Grid

10 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RAkesh
Top achievements
Rank 1
RAkesh asked on 17 Nov 2008, 05:02 PM
Hi,
    Is it possible to populate only those values which are in Grid on filter drop-down in RadGrid.

Regards

10 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Nov 2008, 01:35 PM
Hello RAkesh,

Could you please elaborate a bit on the desired functionality?

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
RAkesh
Top achievements
Rank 1
answered on 18 Nov 2008, 01:55 PM
I was refering to your demo for Grids where 'Google like filtering' is given. I tried the example and it works fine, but it expects developer to know column name and table name (I added this property for joined tables). Also, since the table we are dealing with are having billion rows, its not feasible to use this approach.

My question was, is there facility in RadGrid where in, I can populate my Dropdowns based on the values in my DataSet populating the grid.
0
Daniel
Telerik team
answered on 21 Nov 2008, 03:52 PM
Hello Rakesh,

I'm not sure if I entirely understand your concern. The ComboBox control is populated on-demand (in ItemsRequested handler) and thus your billions of rows won't be loaded when the page is rendered. I suppose you already enabled paging since it's needed for such an amount of data.

Regarding your question. If you catch the ComboBox_ItemsRequested event it's possible to populate the control with whatever data you want.
RadComboBox Load On Demand Overview

Let me know if I missed something.

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rakesh
Top achievements
Rank 1
answered on 21 Nov 2008, 08:42 PM
Please refer to thread http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=175667 where I've mentioned details about it.
0
Daniel
Telerik team
answered on 26 Nov 2008, 09:57 AM
Hello Rakesh,

I saw my colleagues have sent you an example. If your scenario differs from the sample I suggest you modify it and send it back.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Warren
Top achievements
Rank 1
answered on 08 Dec 2008, 04:18 PM
My colleague Rakesh was chasing this issue, now I'll be looking into it. I've already posted the code in another thread http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=178717.

We are looking for some solution urgently.

We are looking for GridDropDownFilter to be populated with values that are part of RadGrid datasource instead of fetching them individually as mentioned in your demo of Google like filtering where you are pulling data from tables by executing a unique query.
0
Daniel
Telerik team
answered on 09 Dec 2008, 01:04 PM
Hello Geof,

Thank you for the provided example. If you do not mind we will continue the communication in the support ticket you opened on this subject. This will help us keep track of the ticket history and provide straight-to-the-point answers. When we find a sufficient solution for you we will share it here with our community as well.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Craig
Top achievements
Rank 1
answered on 07 Apr 2009, 10:39 PM
Have you find an answer to this?  I would like to do the same thing since I am using Object Data Sources that pull data from a 3rd party I don't want to have to make multiple calls to this 3rd party when trying to filter since I already have all the data when the grid loads.
0
Warren
Top achievements
Rank 1
answered on 08 Apr 2009, 12:12 PM
Hi,

Well, I'm not sure if it will fit your requirement and have not tested with ObjectDataSource.
What we have done is created a new GridDropDownFilter column inherited from GridBoundColumn class of Telerik. Below is the code for it.

Protected Overloads Overrides Sub SetupFilterControls(ByVal cell As TableCell) 
        MyBase.SetupFilterControls(cell) 
 
        list = New RadComboBox() 
 
        cell.Controls.RemoveAt(0) 
 
        With list 
            .ID = "list" + Me.DataField          
             
            AddHandler Me.Owner.DataBound, AddressOf Owner_DataBound 
 
 
        End With 
 
    End Sub 
Now, below is implementation of  Owner_DataBound

    Private Sub Owner_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) 
 
        Dim ary As String() = New String(0) {} 
        ary(0) = Me.UniqueName 
 
        If Me.Display Then 
            If Me.Owner.OwnerGrid.DataSource IsNot Nothing Then 
                Dim ds As New DataSet 
                ds = CType(Me.Owner.OwnerGrid.DataSource, DataSet) 
                If ds.Tables(0).Rows.Count > 0 Then 
                    list.ClearSelection() 
                    ds.Tables(0).DefaultView.Sort = Me.UniqueName 
                    list.DataSource = ds.Tables(0).DefaultView.ToTable(True, ary) 
                    list.DataValueField = Me.DataField 
                    list.DataTextField = Me.DataField 
                    list.DataBind() 
                    list.Items.Insert(0, New RadComboBoxItem("(All)", "")) 
                    list.Items.FindItemByText("(All)").Selected = True 
                End If 
 
            End If 
 
 
    End Sub 

I'm aware we are using DataSet to achieve this functionality, but you can convert your ODS to DataView using select() function. Though there are lots of forums where users have complained about it.

Don't worry about performance, as in our case for 1500 rows it takes on 2 seconds to load, entire page after data is fetched from database.


0
Craig
Top achievements
Rank 1
answered on 08 Apr 2009, 05:56 PM
Geof -

Thanks for the reply.  I'll give it a go and let you know.
Tags
Grid
Asked by
RAkesh
Top achievements
Rank 1
Answers by
Daniel
Telerik team
RAkesh
Top achievements
Rank 1
Rakesh
Top achievements
Rank 1
Warren
Top achievements
Rank 1
Craig
Top achievements
Rank 1
Share this question
or