DataGrid with values not saved to the database but want to sort it.

Discussion in 'ASP .Net Datagrid Control' started by UJ, May 13, 2005.

  1. UJ

    UJ Guest

    I have a datagrid where I load the values initially and then the user can
    make changes to the data. That all works fine. But I want to add column
    sorting which I've done before. That works fine. Problem is putting the two
    together because every example of sorting I have seen shows going back to
    the database. But I haven't saved my changes yet so I can't go back to the
    database.

    Here's an example:
    Load page - read from the database.
    Person changes a value on record 1
    Person changes a value on record 3
    They then actually save the values to the database.

    But if sorting goes back to the database, then is they sort after record 1
    changes, they will lose those changes.

    I don't want to write out the changes until they decide they want to save
    everything.

    Any ideas?

    TIA.

    Jeff.
     
    UJ, May 13, 2005
    #1
    1. Advertisements

  2. UJ

    Brock Allen Guest

    > I don't want to write out the changes until they decide they want to
    > save everything.


    So you will need to store these changes somewhere. How are you rebuilding
    the grid when the users sorts? Are you going back to the database? If so,
    then you'd need to DataBind from your database, and then for any data the
    user has changed you'd need to overwrite the data loaded from data binding.
    So I'd look into the DataGrid's ItemDataBound event to get the row that was
    just data bound and manually overwrite the data as necessary. How do you
    store the data? That's up to you. Perhaps a DataSet stored in Session? Just
    an idea.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen
     
    Brock Allen, May 17, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    4
    Views:
    544
    Steve
    Jan 27, 2006
  2. =?Utf-8?B?SlQ=?=
    Replies:
    0
    Views:
    2,302
    =?Utf-8?B?SlQ=?=
    Mar 21, 2006
  3. JerryJ
    Replies:
    11
    Views:
    1,628
    Dave Moore
    Apr 28, 2004
  4. Angus Comber
    Replies:
    7
    Views:
    1,494
    Richard Heathfield
    Feb 5, 2004
  5. manish sahu
    Replies:
    26
    Views:
    1,767
    Nobody
    Jul 12, 2009
  6. Zeng

    datagrid that wouldn't want to sort

    Zeng, Jul 24, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    185
  7. Navin
    Replies:
    1
    Views:
    1,135
    Ken Schaefer
    Sep 9, 2003
  8. Replies:
    3
    Views:
    164
    J├╝rgen Exner
    Aug 3, 2006
Loading...