Online
85572 days on xHamster
29729M profile views
10087K subscribers
14231 comments left

Rowupdating e oldvalues

A friend asked me to help him out on this and frankly it has me completely stumped as well. I have a Grid View control and use old style manual binding with a Data Source property and invoke the Data Bind() method. This will lead to problems like "Grid View does not show updated values", "Grid View looses values changed by user". In your Page_load, this is typically only inside a block where you check to make sure that Page_Load is not being called during a post-back call.For a while now I’m trying to figure out why my method, triggered by the Grid View.

When we edit a row in our Grid View and press the “Update” button, at some time it’s received in the Row Updating method.

In my case this was happening because I was binding to a List of custom objects.

Note A common mistake that a lot of people do is that they perform a databind each and every-time the Page_Load method is called.

But as I noted in the comments in that method, some collections that should contain the columns (names, old values and new values) are always empty. And the Row Updated method is never even touched!!! NET Forums that I need to use a Data Source control.

For example a Sql Data Source, which is automatically added to your Web Form if you drag-n-drop your way around Visual Studio 2005.

New Values -- it will have all the values, as does e. There are two in that event so data source controls can differnitate bewteen the two.

Please or register to post comments
If spammers comment on your content, only you can see and manage such comments Delete all
Hello, i have the same problem. I am trying a new solution using ObjectDataSource for binding data with the Gridview. It seems to be the cleanest way for managing data in a custom gridview. With this method, it may be possible to get the right data in e/OldValues and e. NewValues From. 
03-Oct-2018 14:03
Reply
String logText = ""; // Append the original field values to the log text. foreach DictionaryEntry valueEntry in e. OldValues { logText += + "=" + valueEntry. Value + ";"; } // Append the text to a log file. StreamWriter sw; sw = File. AppendTextServer. MapPathnull + "\\updatelog.txt"; sw. WriteLinelogText; sw. 
03-Oct-2018 14:09
Reply
Nov 8, 2011. Regarding on the GridView control's RowUpdating event problem, it is the expected behavior because when we do not associate GridViewor other ASP. Rowse. RowIndex. Cellsi as DataControlFieldCell; gv. Columnsi. ExtractValuesFromCelle. NewValues, cell, DataControlRowState. Edit, true; } // now you can use. 
03-Oct-2018 14:12
Reply
NewValues and e. OldValues are arrays of all the fields in the gridview data source that are NOT leys, where, as you might guess, e. OldValues are the values before the edit and e. NewValues are the values after the edit. So, to update, you might set the parameters as id = e. Keys"id" and locName = e. 
03-Oct-2018 14:17
Reply

Rowupdating e oldvalues introduction

Rowupdating e oldvalues

Recent posts

03-Oct-2018 20:09
04-Oct-2018 01:38
04-Oct-2018 06:05
04-Oct-2018 14:44