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

Using filters values to query database

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pether Wiklander
Top achievements
Rank 2
Pether Wiklander asked on 04 Dec 2008, 10:29 AM
Hi,

I've been trying to figure out if this is even possible. I have a application with high demands on performance and would like to use the gridview filters for filtering in SQL. I would like to do something like this....

protected void RadGrid_NeedDataSource( object source, GridNeedDataSourceEventArgs e ) 
                ObjectID statusID = null
                IssueStatusDropDownList statusDropDownList = ((RadGridIssueStatusColumn)_radGrid.Columns.FindByUniqueName( "StatusColumn" )).FilterDropDownList; 
                if( statusDropDownList != null ) 
                { 
                    if( statusDropDownList.SelectedValue != IssueStatusDropDownList.ALL_ISSUE_STATUSES ) 
                        statusID = new ObjectID( statusDropDownList.SelectedValue ); 
                } 
 
                List<Issue> issueList = Issue.GetList( statusID ); 
                _radGrid.DataSource = issueList

Is this possible?


1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 08 Dec 2008, 08:00 AM
Hello Pether,

Indeed, such an approach is possible. Additionally, when resetting or changing the selection of the dropdown, you can rebind the grid, ensuring that the NeedDataSource event will be called again, allowing you to pass the new data. Additionally, you can set the filter expression for the control directly, as shown in the following article.
I hope this information helps.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Pether Wiklander
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Share this question
or