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

[Solved] "value" cannot be negative or zero

2 Answers 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
tdekoekkoek
Top achievements
Rank 1
tdekoekkoek asked on 13 Jan 2010, 10:37 PM
When I have a grid pulling ajax data I set the settings like this:

Pageable(settings => settings.Total(Model.Total).PageSize(10).Position(GridPagerPosition.Top))

But if Model.Total is 0 I get the error:

"value" cannot be negative or zero

Surely this is a bug.  It is normal for a result set to be empty under some circumstances.  Is there something else I should set?

Thanks,

Trevor







2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 14 Jan 2010, 09:00 AM
Hi tdekoekkoek,

Indeed this is a known issue which was reported earlier. The hotfix has not been released officially yet however it is very easy to fix it yourself. To do so open "Source\Telerik.Web.Mvc\UI\Grid\GridPagerSettingsBuilder.cs" and replace this code:

public virtual GridPagerSettingsBuilder Total(int value)
{
    Guard.IsNotZeroOrNegative(value, "value");
 
    pager.Total = value;
 
    return this;
}
with this
public virtual GridPagerSettingsBuilder Total(int value)
{
    Guard.IsNotNegative(value, "value");
 
    pager.Total = value;
 
    return this;
}


Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
tdekoekkoek
Top achievements
Rank 1
answered on 20 Jan 2010, 10:24 PM
Thanks.

That did the trick.  I did search for a previous topic, but didn't find one.

-Trevor
Tags
General Discussions
Asked by
tdekoekkoek
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
tdekoekkoek
Top achievements
Rank 1
Share this question
or