skip to content »

Rowupdating datakeynames

Many a times in our applications we use primary keys to get control of the particular record in the gridview.

rowupdating datakeynames-13rowupdating datakeynames-18

André da Silva Carrilho the post has been answered please marke it as Answered :-) Let's say the column value is 15 before I click the update butt... 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.We can achieve the same functionality using Datakeys. 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. Open Visual Studio 2008 and create a new Web Application.

This example won’t hook into a database, but we will create a class to mock a table and retrieve data from it instead. This enables you to not display the ID to the user, yet still being able to retrieve it.

Grid View Sql Data Source, Grid View Template Field Text Box, , ....

Datagrid(1.1) to Grid View(2.0) and using the Row Updating event how to extract the values from the controls. In Custom Control, Grid View Row Updated event not getting called.

One thing you should be careful with your apporach is, if you have paging in your gridview, and if you are in a different page, you might end up pulling out wrong row or the row might not be found.

Instead of looping you can use a linq query on your datasource like if your datasource is a list, obj = l Objs.

When the row is updated, I would like only that row to change and was attempting to do so by storing the original values in a string and using it in the where clause.