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

Paging and filtering

3 Answers 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Duong
Top achievements
Rank 1
Duong asked on 16 Aug 2011, 10:25 AM
Hi,

I have added Radgrid in a page and set AllowPaging="true" . And one of the GridBoundColumn we set AllowFiltering="true" . It works well. But when we filter with a value, the finding record doesn't display in the first page.
For instance, if we have 3 pages and the item which we look for is located in the 3rd page. After filtering, the 1st page and 2nd page are empty. We found the record in the 3rd page. We have to go through all the 3 pages.

Do we have any way to display the finding record in the first page and don't show other 2 empty pages.

Thanks,
D. Do

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Aug 2011, 11:05 AM
Hello Doung,

I cannot reproduce the issue at my end. Check the following demo which implements paging and filtering.
Grid / Basic Filtering.

Thanks,
Princy.
0
Duong
Top achievements
Rank 1
answered on 16 Aug 2011, 02:37 PM
Hi Princy,

I have found out where the problem is located in my code. When we call  

this

.PageGrid.MasterTableView.FilterExpression.
It returns a string like "iif(CreditNumber == null, \"\", CreditNumber).ToString().ToUpper().Contains(\"700000\".ToUpper()))". We use this string in linq, but it seems that linq doens't understand this string.
Do you know how can I parse this string to make it understandable in linq?
(e.g. something like:

 var result = "List of records"

 result.where(this.PageGrid.MasterTableView.FilterExpression)

 )

Regards,
Duong

ps. Ofcourse, we can do something around:

 

string creditFilter = grid.MasterTableView.Columns.FindByUniqueName("CreditNumber").CurrentFilterValue;

result = (creditFilter != string.Empty ? (IQueryable<T>)result.Where(t => t.Creditnummer == creditFilter) : result);

 

 

 

 

0
Duong
Top achievements
Rank 1
answered on 16 Aug 2011, 03:59 PM
Hi,

That was my crucial fout. It must be assigned to a var:
var result = "List of records"

result = result.where(this.PageGrid.MasterTableView.FilterExpression)



 > var result = "List of records"

 > result.where(this.PageGrid.MasterTableView.FilterExpression)

thanks for your time.

Regards

Tags
General Discussions
Asked by
Duong
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Duong
Top achievements
Rank 1
Share this question
or