Getting new value gridview rowupdating event

Rated 3.91/5 based on 699 customer reviews

A Grid View Edit 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 edit operation should be canceled.

I have a dynamically created gridview, it's autogeneratedcolumns is set to True, and it databinds on every postback. If i move the databind to load (which fires before the Row Updating) it ceases to work correctly, and the newvalues are null. Dim o Conn as new Sql Connection("") Dim o Cmd as new Sql Command("Update Sp", o Conn) o Cmd. Guys maybe it's just Friday evening and I've already had 1 Guinness to ease the tension, but you two just flew about 30,000 feet over my head. Crack open reflector and look at the Grid View's source code. The event arguments will ALWAYS be empty unless you are bound to a datasource control. created the following code in VB, and though it runs without error, it's not doing anything for me. This is such a monumental show stopper after all the work I have put into this web site, I can't believe there isn't a straight forward method of retrieving the new values. Edit Index) Dim dict Values As New Ordered Dictionary Dim o Ctl As Control For Each o Ctl In gv Row. Row State, False) End If Next Dim dict Entry As Dictionary Entry For Each dict Entry In dict Values Try Msg Box(dict Entry. To String) Catch ex As Exception End Try Next Public Shared Function Get Values(row As Grid View Row) As IDictionary (Of String, Object ) Dim values = New Ordered Dictionary() For Each control As Control In row. Unfortunately I am getting identical results...same I have always been getting which is just the old values. Try to write a small sample with one column and that one event and see if it works.

"test" will appear in label not "asd" as I would want to. The only thing I'm doing differently (I think) is that I'm creating my grid dynamically. ~Haleigh I'm having the same issue that the original poster is having, but this trick isn't working for me.How do I get the old values in a gridview row in the row_updating event? But it doesn't work for index items greater than 0. Must be non-negative and less than the size of the collection. I'm using a sqldatasource control to populate the grid and want to write the update code in the Row Updating event. I can get the value of the first field using string old_Category = e.

Leave a Reply