Gridview rowupdating boundfield value

Rated 4.17/5 based on 857 customer reviews

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).

In order to develop a test web form create a new web site in VS. Set various properties of the Bound Fields as shown in the following table: Here, we call Bind Grid() method if the web form is being served as a result of first request.

They are: The former event is raised before the current page changes and the later is raised after the page has changed. Write the following code in the Page Index Changing event of the Grid View.

The Page Index Changing event handler receives an event argument of type Grid View Page Event Args.

aspdotnet-suresh offers C#articles and tutorials,csharp dot net,articles and tutorials, VB.

We need to write our own code to update the new values back to the database in the Row Updating event.

The Sort Expression property supplies the sort expression that you specified earlier for the column being sorted.

The Sort Direction property specifies the direction of sorting i.e. This property is not of much when you are sorting the grid on your own.

By default this field renders a link button titled Edit.

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.

Leave a Reply