This GridView example demonstrates the use of CommandFields,
setting the GridView for editing, and updating a datasource.
Column 1: BoundField column that is bound to the database field
ProductNumber
.
Column 2: BoundField column that is bound to the database field
Description
.
Column 3: BoundField column that is bound to the database field
Price
.
Column 4: TemplateField column that has a textbox bound to the database field
QOH
.
Column 5: TemplateField column that has a textbox used with the Update button to modify the QOH value for a record stored the database.
Column 6: CommandField column with Select button. Codebehind displays the ProductNumber of the selected row.
Column 7: CommandField column Edit button. Enables database update of QOH in Column 5.
Product ID
Description
Price
QOH
Add Qty
Show Product
Edit Product
1
Windows Vista
$50.00
10
Visual Studio 2005
$12.00
11
Xbox 360
$123.00
12
Playstation 3
$90.19
1234312
DeleteMe
$12.00
13
Apple iPhone 2
$145.00
14
Apple iTouch
$200.00
15
Bello TV Stand
$70.00
16
Bush Office Chair
$120.00
17
Windows 7 Ultimate
$399.99
2
Windows XP Professional
$45.00
3
Samsung 50" Plasma TV
$1,819.99
4
Panasonic 60" Plasma TV
$3,500.00
5
Whirlpool Centralpark Refrigerator
$12,345.00
5678
PSP2
$200.00
6
Bush Office Desk
$129.99
7
Dreamweaver CS4
$300.00
777
This is my test
$1,234.50
8
Microsoft Office 2007
$199.99
888
Another test
$12.23
9
Visual Studio 2008
$20.00
999
Last test product
$456.75
2302
Xbox Series X
$499.99
2303
Playstation 4
$299.99
2304
Playstation 5
$599.99
2202
iPhone X
$789.99