Monday, 18 March 2019

How to Display data from Database to GridView Control in ASP.NET

How to Display data from Database to GridView Control in ASP.NET


Step 1: Create a New Empty Web Application then add a Web Form to that application

Add GridView and SqlDataSource Control to the Web Form

The Page Design will Look like this

Default.aspx
Default.aspx.cs[Code File]



Step 2: Add a Database to the Web Application
This also same procedure like how we added the web form
Website --à Add New Item -àSQL Server Database



For Creating Tables in the database first You have to select the Database Explorer
















You have Select Tables Folder then right-click and Select Add New table


Then Add Table Columns and its Data Types



After Specifying all the Columns and DataTypes Press Ctrl+S to save the table with its Name Here it is info.

Note: Add information to the table


Step 3: We require Connection String to Obtain the connection between the Front-end Application with Back-end.



Click the Configure Data Source
Keep on clicking next then click Finish Button.
The Connection is created.

Step 4: Output. To execute the program press Ctrl+F5





Post a Comment

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search