Codeless sorting paging GridView using SqlDataSource in C# VB.Net

At first this post is only for beginner. Here i am introducing the most popular control in is GridView. A tremendous improvement over asp. Do you think that without writing a single line of code you can present a page with sorting & paging facility? Yes you can do it with few clicks just follow my below steps:

Modify your web.config file to write the connectionstring:

<add name="TestConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TESTDB;Trusted_Connection=yes;" providerName="System.Data.SqlClient"/>

Note: Modify the connection string as per your Database settings.

Now add a SqlDataSource and follow below steps:



Now click on Finish.

Now Add a GridView in your Page and Follow Below Steps:

Note: Don’t forget to checked “Enable Paging” & “Enable Sorting”. Also set the “PageSize” property as per your requirement from GridView Properties.

Now run the project. Hope you will get an output like below:
Codeless GridView Sorting Paging Csharp VB.Net

Download Code Example C#        Download Code Example VB.Net

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code