Gridview rowupdating event from code


15-Dec-2019 12:16

But what happens is that I do get some of the values but they are the original values not the new ones being changed.

In the code below I do get the Country ID and Region ID but they are the original values not the new ones selectedfrom the Edit Mode row.

In this tutorial we are searching for our Text Box controls txt Product Name and txt Unit Price.

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

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

I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.

All logics can be placed in Row Updating event handler. When clicking on either of these controls, my break point is never hit in the event method. Hi, I create a Gridview dynamically binding a Datatable as a datasource.

AARP_DATA_D1_Bill Matri It still gets the old values, when I loop thru the Dictionary and in debug step thru it I see it still gets the original values not the new values that the user enters when they are changing each item.

// Iterate through the New Values collection and HTML encode all // user-provided values before updating the data source. New Values) guru_sami, sorry it took me so long to get back, I have been off on vacation and just got back, but yes you are right on, I went back and debugged the entire postback and it was rebinding the grid on postback on the page_load event.

Please keep in mind that there are many different ways to update the database using the Grid View control depending on the type of data you are updating and the functionality the user need and there are many solutions to achieve the same end result.

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.To do this we first need to obtain the reference of the current row by using its index no as shown in the first line below.



Why get bogged down with inconvenient registration pages when you don’t have to?… continue reading »


Read more

The fact is that every person has heard a high schooler brag about his romantic conquest with the lines like “yeah, I totally went to second base with Michelle last you, you know it, ha-ha”: high fives his friend.… continue reading »


Read more

Probably every woman in India has one story about having been subject to lecherous looks as she has walked down the street. The male gaze turns more brazen by several orders of magnitude.… continue reading »


Read more

The first photo is your first impression — try and remember that when you're coming up with your collection.… continue reading »


Read more