Updating dataset with gridview

08 Apr

May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.

Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.

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.

In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel. We will use Template Field, whenever we want to define some custom control in the data bound controls like Grid View, Data Grid or Data Repeater.If he clicks edit (or) in the edit mode he can be able to see the Textbox.We set Page Index property of the Grid View to this new page number and call the Bind Grid() method again.This will display the corresponding records in the Grid View.