This question is locked. New answers and comments are not allowed.
This is my first day using the Telerik Extensions for ASP.NET MVC. I'm trying to implement Custom Server Binding as described in the documentation. My problem is that the GridCommand parameter values are not being set properly. Specifically, the Page and PageSize properties are always 0.
My data is being returned and displayed properly in the grid; but, all of the rows are being displayed and not just the first 10 items, even though the grid footer says, "Displaying items 1 - 10 of 59".
If I mouse over the page controls in the grid footer, I can see in the browser status area that the URL parameters are being added to the request. However, when I click one of the numbers, again the GridCommand parameter shows 0 for Page and PageSize in my controller method.
I'm running Windows 7, IE8, VS 2010, and the ASP.NET development server.
Thanks.
My data is being returned and displayed properly in the grid; but, all of the rows are being displayed and not just the first 10 items, even though the grid footer says, "Displaying items 1 - 10 of 59".
If I mouse over the page controls in the grid footer, I can see in the browser status area that the URL parameters are being added to the request. However, when I click one of the numbers, again the GridCommand parameter shows 0 for Page and PageSize in my controller method.
I'm running Windows 7, IE8, VS 2010, and the ASP.NET development server.
Thanks.
6 Answers, 1 is accepted
0
Hi Vince,
Which version are you using? This sounds like a bug fixed in 2010.1.518.
Greetings,
Atanas Korchev
the Telerik team
Which version are you using? This sounds like a bug fixed in 2010.1.518.
Greetings,
Atanas Korchev
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
Vince
Top achievements
Rank 1
answered on 22 Jun 2010, 12:23 PM
I'm using version 201.1.518.235.
I also tried with IIS instead of the ASP.NET development server, and with Firefox instead of IE8 and the problem persists. Also, I'm running .NET 4.0. Let me know if there's any additional information you need or anything else I can try. Thanks.
I also tried with IIS instead of the ASP.NET development server, and with Firefox instead of IE8 and the problem persists. Also, I'm running .NET 4.0. Let me know if there's any additional information you need or anything else I can try. Thanks.
0
Accepted
Hello Vince,
I am sending a sample project showing how to utilize custom server binding.
Regards,
Atanas Korchev
the Telerik team
I am sending a sample project showing how to utilize custom server binding.
Regards,
Atanas Korchev
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
Vince
Top achievements
Rank 1
answered on 23 Jun 2010, 04:52 PM
Thank you very much. The example you sent helped me solve the problem. For future reference for anyone else who might run into this, the Custom Server Binding example on the web site and in the help documentation is incorrect/incomplete: the GridAction attribute is missing the GridName property (the sample you sent also includes the EnableCustomBinding property, but my testing indicates this isn't necessary) .
Also, it should be explicitly stated that the Page and PageSize values will both be 0 for the first request. Therefore, the example, should look like this:
Thanks again for your help.
Also, it should be explicitly stated that the Page and PageSize values will both be 0 for the first request. Therefore, the example, should look like this:
| [GridAction(GridName = "Grid")] |
| public ActionResult Index(GridCommand command) |
| { |
| if (command.PageSize == 0) |
| { |
| command.PageSize = 10; |
| command.Page = 1; |
| } |
| IEnumerable<Order> data = GetData(command); |
| var dataContext = new NorthwindDataContext(); |
| //Required for pager configuration |
| ViewData["total"] = dataContext.Orders.Count(); |
| return View(data); |
| } |
Thanks again for your help.
0
Vince
Top achievements
Rank 1
answered on 23 Jun 2010, 06:48 PM
I think I found a bug:
When using Custom Server Binding, if you select a column to sort the grid immediately after displaying the first page (before selecting any page controls to move beyond the first page), then GridCommand.Page is set to 0 instead of 1 (the PageSize is set properly).
The workaround is to explicitly check for Page of 0, so the above code would be changed to:
When using Custom Server Binding, if you select a column to sort the grid immediately after displaying the first page (before selecting any page controls to move beyond the first page), then GridCommand.Page is set to 0 instead of 1 (the PageSize is set properly).
The workaround is to explicitly check for Page of 0, so the above code would be changed to:
| if ( command.PageSize == 0 ) |
| { |
| command.PageSize = 10; |
| } |
| if ( command.Page == 0 ) |
| { |
| command.Page = 1; |
| } |
0
Sdd
Top achievements
Rank 1
answered on 20 Jun 2011, 08:00 PM
I am aware that this is a very old post. But I found the exact issue in my code -
"When using Custom Server Binding, if you select a column to sort the grid immediately after displaying the first page (before selecting any page controls to move beyond the first page), then GridCommand.Page is set to 0 instead of 1 (the PageSize is set properly)."
Just wanted to know is this fixed? I am working on version for MVC3 - 2011.1.315.340.
Thanks.
"When using Custom Server Binding, if you select a column to sort the grid immediately after displaying the first page (before selecting any page controls to move beyond the first page), then GridCommand.Page is set to 0 instead of 1 (the PageSize is set properly)."
Just wanted to know is this fixed? I am working on version for MVC3 - 2011.1.315.340.
Thanks.