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

[Solved] Grid CustomBinding with Stored Procedure has bug.

5 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Amit
Top achievements
Rank 1
Amit asked on 21 Nov 2010, 08:18 AM
After going through the tutorial http://demos.telerik.com/aspnet-mvc/grid/custombinding?theme=vista I could successfully manage to get data on the grid, which is filterable and sortable. However, after putting the filter there is no way that I can reset the record count and it is still using fake paging numbers.

There is no way I can get to know the count of the records after the filter, and if I try to make a call to the count() function, I get the following error on sorting.

The query results cannot be enumerated more than once.

Difference in my work and your work is that you are using straight the EF but in my case I am using stored procedure and that is the ideal case where someone might want to use custom binding.

Either you should change and implement the same in your tutorial or suggest us how to achieve.





5 Answers, 1 is accepted

Sort by
0
Anthoni
Top achievements
Rank 1
answered on 23 Nov 2010, 12:13 AM
You should be able to do this by having the total record count as an out parameter in your stored procedure.
0
Amit
Top achievements
Rank 1
answered on 23 Nov 2010, 12:15 AM
You cannot because the count does not matter after SP. The count is require after SP data has been fetched and the filter (offline through D LINQ) has been applied.

If I count then I use same object throws the said exception above.
The query results cannot be enumerated more than once.
0
Flame Boy
Top achievements
Rank 1
answered on 23 Nov 2010, 05:17 AM
Try adding .ToArray() to the collection you are binding to
0
Amit
Top achievements
Rank 1
answered on 25 Nov 2010, 04:55 AM
No it does not work in that way either. Please help as it is really annoying.
0
pizarro1907
Top achievements
Rank 1
answered on 27 Dec 2010, 06:53 PM

please if you know how to show the data that comes with a stored procedure in the mvc telerik grid object, I ask you to leave an example because there are several that have that question as In the top of the page you specify a model which can be an IEnumerable, finally a method which converts the information stored in ienumeable or datatable not serve because I think the top of the page requested calls a model.
my question is how to list a stored procedure on the grid object instead of a query with linq to sql.
I hope can help mirror this question that I have spent time in decifrala, thank you very much.

 

Tags
Grid
Asked by
Amit
Top achievements
Rank 1
Answers by
Anthoni
Top achievements
Rank 1
Amit
Top achievements
Rank 1
Flame Boy
Top achievements
Rank 1
pizarro1907
Top achievements
Rank 1
Share this question
or