But Values retrieved from the tex Boxes are old values (not the newly typed in values in Edit mode) So in effect no updating is happening. Tell me where I have gone wrong and Please suggest some ways to fix this problem. Here, when click Edit button on "C" row, and modified values from f1C to f1CXX; and in the rowupdating method, it is getting f1CXX only... I am getting some problems in the code you posted aslo. The below is my connection string which is stored in web.config file. If you are using my database, just copy and paste the code or use the attached application.
I am sharing this because I see a lot of questions on the forums on how to get the value from the Grid View object, and I know how.
As a beginner it's very tough and challenging to work with controls like a Grid View in ASP. Even I faced difficulties at the starting point of my career. Here, I am not going to explain about Grid View and other events in it, because there are a lot of good articles about that.
' I am marking this also as answer,,let other less understanding guys like me benefit..
Yes it is IF NOT Is Post Back, HAHAHAHA I am a more familier with VB ..missed to read that '!
A Grid View Update Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the update operation should be canceled.
To cancel the update operation, set the collections, if necessary, before the values are passed to the data source.
But ensure that the control/link is inside the Grid View, only then can we cast sender as Grid View.
This code is a bit complex but just add it knowing that we may refer to it in the future.
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.
Dear All, In Row Updating event of a Grid View I am trying to update the database picking the values of bound text Boxes in the Edit Item Templates. I confirmed update works by giving some other text vlaues instead of those retrieved from TB1, TB2, and TB3. I checked your code, it is working very good; below example of the code I used here...
In this article, I will show you how to use an ASP.