Gridview rowupdating vb

The Cancel property allows you to cancel the sorting operation.Since we are not using data source controls we need to handle the toggling of the sort direction on our own. Add the following code in the Sorting event handler.Once we click on edit the Grid View raises an event called Row Editing and the Edit link button changes to Update and Cancel link buttons.Clicking on Update link button raises Row Updating event whereas clicking on the Cancel link button raises Row Canceling Edit event.Fortunately Grid View can also be used without attaching with the Data Source Controls. In this article we will see how paging, sorting and editing can be implemented in a Grid View control that is bound with a Data View (or Data Table) directly.This calls for some extra coding from developer's end. As an example we are going to use Employees table of the Northwind database. Add three Bound Fields and a Command Field to the Grid View with the help of Fields dialog (see below).

This will display the corresponding records in the Grid View.

The method essentially binds the Grid View with a Data View.

The Data View supplies all the records from the Employees table.

Similarly we set a View State variable called sortdirection. In order to edit records displayed in the Grid View, we need to add a Command Field to the Grid View.

By default this field renders a link button titled Edit.

Leave a Reply