Asp net gridview onrowupdating

06-Feb-2018 06:36

To get the Primary Key reference we can use the Data Keys collection of the Grid View.

This collection only requires the row index no and it will give us the primary key.

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

you need to set Auto Generate Columns property false and create the required columns for the grid using property within the html source of the grid in whatever order you want.

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.

Now you can ask questions directly to me on my new site ASPForums.

asp net gridview onrowupdating-64

For demonstration I have created a database (named Database.mdf) in which we have a table named tbl_Employee.

In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.

These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.

I'm trying to get the text of a Hyper Link Field in a Grid View's On Row Delete event (the Hyper Link Field's text is the primary key of the row I wish to delete).

I understand that you can't get the text using the code I've placed below; it only works for Bound Fields (for Hyper Link Fields, the string is ""). I tried this with Cells[1] (a Bound Field) and got the string I expected.

For demonstration I have created a database (named Database.mdf) in which we have a table named tbl_Employee.

In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.

These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.

I'm trying to get the text of a Hyper Link Field in a Grid View's On Row Delete event (the Hyper Link Field's text is the primary key of the row I wish to delete).

I understand that you can't get the text using the code I've placed below; it only works for Bound Fields (for Hyper Link Fields, the string is ""). I tried this with Cells[1] (a Bound Field) and got the string I expected.

Data Grid Example " data-medium-file="https://jwcooney.files.wordpress.com/2013/09/gridviewexample.gif? Sometimes using Web Forms controls is not well documented and unintuitive, which is the case with the event, where a lot of information available online is incorrect or misleading. If they do (or if they don’t), then please leave a comment.