Onupdating gridview

In Bind Data() method, I am getting the data from database using Sql objects and specifying the Data Source property of the Grid View to the Pages Data table of the Data Set.

When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.

A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source.

In this article, I am going to explain how to manipulate data using Grid View control.

Now let’s start with putting the Grid View on page. Data Key Names="Auto ID" Auto Generate Edit Button="True" On Row Editing="Edit Record" On Row Canceling Edit="Cancel Record" On Row Updating="Update Record" Cell Padding="4" Header Style-Horizontal Align="left" On Row Deleting="Delete Record" Row Style-Vertical Align="Top" Fore Color="#333333" Grid Lines="None" In the above code, I have kept Auto Generate Columns as false so that Grid View will not render all the fields of the data source automatically.

I have specified Data Key Names as Auto ID, the primary key of the database table.

This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.

In practical scenario you should use your existing architecture to populate and update the data.

In this article, I am going to take a simple database table that has following fields: Auto ID - Int, Auto Increment, Primary Key Page Name - Varchar(50) Page Description - Varchar(500) Active - Bit(1) In this article, I am not going to explain the workings of Sql objects but focusing on the events and methods of the Grid View that will help us in updating and deleting the records.

In this method, we have to get changed values of Text Box and Drop Down list and also we need the primary key value for the record that is being edited.

To get the Primary key, I have used Data Keys property of the Grid View with the index of the row, being edited and stored into a integer variable after parsing.

Leave a Reply

  1. dating site to date 24-Feb-2018 02:00

    In the Internet there are a lot of both paid and free video chats.