Updating dataset with gridview

The Bind Grid() method is our own function that we will create later on.

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

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

There are many articles and tutorials around that illustrate the use of Grid View control along with the new Data Source Controls.

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.

updating dataset with gridview-32updating dataset with gridview-10

On Row Updating is fired when the 'Edit' button is clicked.Clicking on Update link button raises Row Updating event whereas clicking on the Cancel link button raises Row Canceling Edit event.We need to write our own code to update the new values back to the database in the Row Updating event.Further, you need to set Sort Expression property of the Bound Fields to the name of the column on which you would like to sort the grid.Once you set these properties you will find that the column headers of all the columns for which you specified Sort Expression property appear as clickable link buttons.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.Here, we store the value of Sort Expression property into a Veiw State variable called sortexpression. Finally, we call Bind Grid() method which will bind sorted version of the Data View with the grid.Clicking on the link buttons raise two events: Just like paging events these events follow pre and post pattern.The Sorting event allows you to cancel the operation also.The Data View supplies all the records from the Employees table.In order to implement paging you need to set Allow Paging property of the Grid View control to True. There are two events of Grid View that are related to paging.


  1. How would you update a SQL database from a gridview? after a record has been updated Using - SharePoint - Application page - I know, SharePoint.

  2. Note. The feedback system for this content will be changing soon. Old comments will not be carried over. If content within a comment thread is important to.

  3. This article explains how to use GridView with the simple and rich Twitter Bootstrap's Modal jQuery plugin to implement a complete CRUD package in.

  4. In earlier tutorials we saw how the GridView control makes it simple to edit and delete text data. In this tutorial we see how the GridView control also.

  5. Free gridview video tutorials for beginners and intermediate programmers

  6. You need to check the e. NewValues dictionary for updated data. I've a sample below, the GridView Template is bound to CategoryName. OnRowUpdating is fired.

Leave a Reply

Your email address will not be published. Required fields are marked *