VB.Net GridView Control Edit Update Cancel Commands in ASP.Net

ASP.Net GridView control provides a CommandField which can be handled at server side using VB.Net code that enables you to display the Edit, Update and Cancel Command buttons and perform their associated actions. You can easily attach the GridView events in the VB.Net code such as RowEditing, RowCancelingEdit and RowUpdating to implement the edit, update and cancel commands of GridView control.

Command Events Used

1. OnRowEditing

2. OnRowCancelingEdit

3. OnRowUpdating

 

GridView Property Used

1. DataKeys

 

The DataKeys property of GridView control enables you to hold the unique identifier values for each row generated inside it. The DataKey value can be retrieved using VB.Net for the associated row item that can be used to perform the edit and update action for that particalur row item in the database as well.

 

Try the sample below to understand the functionality developed using VB.Net code for GridView Control's Edit Update Cancel Commands in ASP.Net:

 

IDCategory NameDescription 
1 Beverages Soft drinks, coffees, teas, beers, and ales Edit
2 Condiments Sweet and savory sauces, relishes, spreads, and seasonings Edit
3 Confections Desserts, candies, and sweet breads Edit
4 Dairy Products Cheeses Edit
5 Grains/Cereals Breads, crackers, pasta, and cereal Edit
6 Meat/Poultry Prepared meats Edit
7 Produce Dried fruit and bean curd Edit
8 Seafood Seaweed and fish Edit

  • HIRE EzineASP.Net Developers