Net-informations.com

ASP.NET Simple GridView

The GridView control provides many built-in capabilities that allow the user to sort, update, delete, select, and page through items in the control. The GridView control can be bound to a data source control, in order to bind a data source control, set the DataSourceID property of the GridView control to the ID value of the data source control.

asp.net gridview

Download Database

In this article I have used Microsoft's Pubs database for sample data. You can download it free from the following link.

Download

Before you start to generate GridView in your asp file, you should create a ConnectionString in your web.Config File. Double click the web.config file on the right hand side of the Visual Studio and add the following connectionstring code in that file.

web.config file

Web.Config File

After create the connectionstring in the web.config file, you should call the connectionstring in your asp page and issue the select command.

When you run this asp.net application , your output look likes the following image.

simple-gridview

The following is the full asp source code for selecting au_lname,phone,address,city from the authors table in the Pubs database.

Asp.net gridview example

Default.aspx







net-informations.com (C) 2019    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About