Editing and updating in gridview in asp net

In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int.

In a previous post we saw how easy is to bind data to a Grid View control, without using a build in Data Sources.

Use the same modal popup extender which we use for adding new users and same html will be used, when we go for updating the record we will keep Id in hidden field and pass to update the rocord.We will always open modal popup from code behind so we can execute all the necessary methods.First of all we will create a table Users CREATE TABLE [Users]( [User ID] [int] IDENTITY(100,1) NOT NULL, [User Name] [varchar](50) NULL, [Address] [varchar](100) NULL, [City] [varchar](50) NULL, [State] [varchar](50) NULL, CONSTRAINT [PK_Users] PRIMARY KEY ([User ID]) ) Some points which you need to understand, in Modal Popup Extender we used Behavior ID which will help to find the modal popup and close it.The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.By default all the boundfields will be trasferred as Textboxes in Edit Mode.

Search for editing and updating in gridview in asp net:

editing and updating in gridview in asp net-54editing and updating in gridview in asp net-20editing and updating in gridview in asp net-59

Leave a Reply

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

One thought on “editing and updating in gridview in asp net”

  1. What we forget is that even if a person hasn’t just exited a relationship, aside from knowing our own boundaries (which can rule out certain things that we’ve already made a decision on in advance of), we cannot get all of the answers upfront or have someone tell us what ‘the ending’ will be.

  2. But fans of Detective Inspector Winston Woodward, crime manager at Albury, on the NSW-Victorian border, have praised the officer's actions and reckon there should be more cops like him.

  3. “[Men faced in this real life scenario] distanced themselves more from her, tended to rate her as less attractive, and showed less desire to exchange contact information or plan a date with her”.