Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My code
XML
public ActionResult commenter(int? page)
       {
           List<comment> c = db.comments.ToList();
           int pageSize = 3;
           int pageNumber = (page ?? 1);
           return View(c.ToPagedList(pageNumber, pageSize)); ;
       }

This is the code for paging in mvc
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jun-14 1:40am    
Not a valid question. Showing a fragment of the code taken from who-knows-where does not mean anything. (If it was your code, you would probably know your intention.) This is not a productive way of getting some knowledge. Write code instead of searching of some solution. If you do something different, remember that this site is for software developers.
—SA

1 solution

'??' is the null coalesce operator.
It means that the value of the 'page' variable is returned, unless it is null; if page is null, 1 will be returned.

?? Operator (C# Reference)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900