Wednesday, November 12, 2014

How To Bind GridView Using Sql DataSource And Without Code



1.       Drag and drop the grid view from the tool box

2.       Go to design view of the page and then click on grid after that a small arrow will appear near to the grid

3.       Click on the arrow Then choose new datasource

4.       Select sql and press ok

5.       Click on New connection string 

6.       Connection popup will open choose the sqlserver and database name

7.       Press next and the connection string you choose is default type over there

8.       Select table from the database and check the checkboxex which you want to display in grid

And press next
9.       Click on the test query this will appear the data available in the box press finish

10.   You will see the column names in the grid view which you selected

11.   Now see the application in the browser it will display the data in grid view
 Now if you want to enable paging and sorting then go to design view and click an arrow of the grid 

12.   Just check the enable paging and sorting checkbox

13.   Now again run the grid view comes with pagination and sorting click on the column name so it will sort it in ascending or descending order


No comments:

Post a Comment