ASP.NET Paging and Sorting records in GridView control using VB.NET

Here, we describe how to paging and sorting records in GridView using SqlDataSource.
  • 2047

Here, we describe how to paging and sorting records in GridView using SqlDataSource. In this article we create connection string and create connection with database without write a single code.

Step 1:

Go to the design view of aspx page and drag a GridView control from toolbox on the form. SetAutoFormate= Colorful to display colorful GridView.

gridview1.gif
 

Figure1.

Step 2:

Now click on smart tag of GridView and choose new datasource.

gridview2.gif
 

Figure2

Step 3:

Now select a database.

gridview3.gif
 

Figure3

Now click on OK Button.

gridview4.gif
 

Figure4

Step 4:

Now click on the test connection Button. and give server name user name and password and select database from the Dropdown list.

gridview5.gif
 

Figure5

Now click on the OK Button. Connection string will be display.

gridview6.gif
 

Figure6

Now click on the next Button.

gridview7.gif
 

Figure7

Now select a table from the drop down list. and click on the next Button.

gridview8.gif
 

Figure8

At the end click on the Finish Button.

After that click on the smart tag of GridView and select paging and sorting.

gridview9.gif
 

Figure9

Set page size property=4

Now build and run the application.

gridview10.gif
 

Figure10

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.