Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
how to get previous value of a cell on updateRow event
posted

Hi friends,

Basically I need the previous value of a cell or cells when I modify a row. Thus I can find the item in my database and then update it.

 Thanks in advance.

Talo

Note: The previous cells value are a part of the primary key.

  • 90
    posted

    The RowEventArgs parameter in your event handler has two objects - Row and Data.  Row contains the new details and Data contains the old details.

    Something like UltraGridCell oldValue = ((UltraGridRow) e.Data).Cells.FromKey("Description"); will get you the old cell. 

    I'm assuming you're talking about the server-side events here. 

  • 8680
    Verified Answer
    posted

    bbo0t said:
    I need the previous value of a cell or cells when I modify a row. Thus I can find the item in my database and then update it.

    If your database table has a primary key, save that in a hidden column and use it to find the record you want.

    If there isn't a primary key, your SELECT statement could return two instances of the value you need, like this:

    SELECT MyColumn, MyColumn AS MyColumnForLookup FROM MyTable

    Then, put the second instance in a hidden column and use it to find the record you need.