Display Data in GridView Using ASP.Net

Introduction

A GridView is a control for displaying data in a tabular format. This control provides features for the insertion, deletion and modification of data from the database that is then displayed in the GridView. ASP.NET prepares columns and rows automatically with the default option and then displays it. The main advantages of a GridView is to have several sets of automatic controls that does the CRUD operations.

Step 1

First we need to start Visual Studio.


Step 2

Now we need to create a project using "File" -> "New" -> "Project...".


Step 3

In the next step we select the ASP.NET Web Application and provide the name of the application. I wrote the name GridView for the application.


Now we choose the form. I have selected the Empty WebForm.


Step 4

Now we will add the WebForm by right-clicking on the project and add WebForm.


We will provide the name for the WebForm depending on the project.


Step 5

After creating the WebForm we will drag the GridView onto the WebForm.

Step 6

Now we need to choose the DataSource.


After selecting the new DataSource, we will choose the Data Source Type and click on the OK button.


Now choose the Data Connection or create a new connection.


Step 7

After creating the connection we need to save the Connection String.


Step 8

Now to configure the Select and click on the Next button.


Step 9

The next step is to test the query and click on the Finish button.


Step 10

Now we will execute the application of GridView using the F5 key.


Summary 

I hope this article is helpful for the beginners, when they want to use the GridView Control.

Next Recommended Readings