A table control provides editing, sorting, and deletion functions. Two data binding methods are available: the DataSource attribute or the performanceid attribute (two-way data binding is supported)
Common Properties and descriptions of Gridview:
Common methods and descriptions of Gridview:
You must use the DataBind method when using the Gridview for data binding.
Common Gridview events and descriptions:
How to perform operations on the database without writing any code: (the database connected here is a database of the SQL Server Series)
Step 1:
Drag the Gridview and SqlDataSource controls to the. apsx design interface from the toolbox.
Step 2:
Click Configure data source in to display:
Click Create connection, configure the database to be connected, and click Next... Until the following page is displayed:
Select the table name and query condition to be operated, and click Next to view the test query. After the test query is successful, the corresponding data is displayed. If the query result is expected, click Finish.
Step 3:
Click the small button (as shown in <) in the upper-right corner of the Gridview control, as shown in the following figure:
After selecting the data source
To enable pagination, you only need to check enable pagination and specify the Pagesize value in the Gridview control attribute as the number of entries to be displayed on each page (10 by default ).
Step 4 (edit and delete)
Configure the data source again for the SqlDataSource control and go directly to the second image in step 2. Click "advanced ".
Select both of them (if both are optional, the data table requesting the operation does not have a primary key defined) and click OK.
Select, and then click Next.
Repeat Step 3 to see:
Select edit and delete.
From jory