Tag Archives: NUGET

How to use PagedList.MVC in MVC5 using VB.NET

Installed the PagedList.MVC  in your project using the NuGET

This is the ASP.NET Syntax

In your Controller

Here

At the top of the Controller add the following two imports

Imports PagedList
Imports PagedList.Mvc

 

Here is a sample ViewResult

Function NewVideos(Optional ByVal Page As Integer = 1) As ViewResult
Dim videos = rep.GetNewVideos.ToPagedList(Page, 10)  ‘ Code to get your data  use your own

ViewBag.CurrentSort = videos
Return View(videos)

End Function

 

In your View

At the top of the page add the following imports

<%@ import Namespace=”PagedList” %>
<%@ import NameSPace=”PagedList.Mvc” %>

 

Where you want the Pager to appear add the following code. Customize it according to your need.

 

<%: Html.PagedListPager(DirectCast(ViewBag.CurrentSort, IPagedList), Function(page) Url.Action(“newvideo“, New With {.page = page}), PagedListRenderOptions.OnlyShowFivePagesAtATime)%>

How to add Nuget Packages

How to Add Packages using NUGET in Visual Studio

Step 1

In Visual Studio Go to Tools > Library Package Manager > Manage Nuget Packages for Solution.

 

How to add Nuget Packages
How to add Nuget Packages

 

Step 2

You would get the following screen, you can check the packages which you have already available in your solution, you can search for new packages and install them to your solution.

Remember:  These packages need to be downloaded , each time you create a new Visual Studio solution

 

Packages in NUGET
Packages in NUGET