Updating in gridview
Now you can ask questions directly to me on my new site ASPForums. Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.Now I will show you the C# code behind file of the above ASP.In Part 18 of the An Extensive Examination of the Data Grid Web Control article series, I showed how to dynamically update a sortable Data Grid's header columns so that an up or down arrow image would appear next to the sorted column name depending on whether the column was sorted ascendingly or descendingly (view a live demo).
I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.
Please keep in mind that there are many different ways to update the database using the Grid View control depending on the type of data you are updating and the functionality the user need and there are many solutions to achieve the same end result.
In the above tutorial I tried to give you one of the easiest solutions and I hope you can go explore Grid View control editing further after learning the basics from this tutorial.
So, from the end user's perspective, she clicks the text in a particular column header and the data is sorted by that column.
For more information on sorting with the Grid View, along with a downloadable demo, check out the Paging and Sorting Report Data tutorial.
I encourage you to still read this article to get an overview of the rationale behind the custom Grid View control and to understand the initial architecture. NET 2.0, the Grid View control serves as a much more functional and feature-rich choice.