0% found this document useful (0 votes)
0 views9 pages

Filling GridView Using C-Sharp Code

The document provides a step-by-step guide on how to display data in a GridView using C#. It includes instructions for designing a database, creating a new website, adding a data access class, and configuring the GridView in the ASP.NET application. The author is Saif ur Rehman Saifi, an Assistant Professor at PMAS Arid Agriculture University, Rawalpindi.

Uploaded by

Fawad Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views9 pages

Filling GridView Using C-Sharp Code

The document provides a step-by-step guide on how to display data in a GridView using C#. It includes instructions for designing a database, creating a new website, adding a data access class, and configuring the GridView in the ASP.NET application. The author is Saif ur Rehman Saifi, an Assistant Professor at PMAS Arid Agriculture University, Rawalpindi.

Uploaded by

Fawad Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

How to show data in GridView

[Type text]
To fill a grid view using the C-Sharp code, we have to follow these steps
Steps are:

1. Design a Database, named ICS


a. Design a table tblITemClass (ItemClassSID, ItemClass, ItemclassDescription)
b. Add some data to the table

2. Design a new Website


a. Add a class as shown here:

Click Add New Item, you will see the screen

[Type text]
Select Class, and rename it as DAL.CS

Next, Press Add Button

You will see the message as shown

Press Yes button

This will add a new class named DAL.CS under app_code folder as shown here

[Type text]
Add the following line of code as highlighted in the figure below

Next, declare a variable of type string as shown in the highlighted line below

Now, add the text as shown in the highlighted line below

[Type text]
Add the method as shown in the figure in the indicated space

Now, open the default.aspx page as shown

[Type text]
Drop and drag the GridView from the tool box in between <div> tag as shown

[Type text]
Now, open the default.aspx.cs file from the solution explorer

Choose the Open option

You will see the code as shown

[Type text]
Now add the line as shown in the highlighted line

Add the following code as shown in the highlighted line below

[Type text]
Now, run the application and see the output

By:

Saif ur Rehman Saifi

Assistant Professor

UIIT, PMAS Arid Agriculture University, Rawalpindi

Email: [email protected]

[Type text]

You might also like