Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Razor JSON to list
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 476983" data-attributes="member: 36373"><p>Instead of +1 on the page size you should do Math.Ceiling so it gets to a full page number and you don't need to worry about rounding. You also wouldn't need the ternary operator. Just set page Count = Math.Ceiling(countitems / pagesize);</p><p></p><p>You're looping through the pages so it's going to print them all. You usually have some sort of indexer to know what page your on. Could be a URL parameter or component state variable. You only want to run the query once on your current page.</p></blockquote><p></p>
[QUOTE="JayC, post: 476983, member: 36373"] Instead of +1 on the page size you should do Math.Ceiling so it gets to a full page number and you don't need to worry about rounding. You also wouldn't need the ternary operator. Just set page Count = Math.Ceiling(countitems / pagesize); You're looping through the pages so it's going to print them all. You usually have some sort of indexer to know what page your on. Could be a URL parameter or component state variable. You only want to run the query once on your current page. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Razor JSON to list
Top