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. Advertising

  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. Advertising

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. =?Utf-8?B?SlQ=?=
    Replies:
    0
    Views:
    2,162
    =?Utf-8?B?SlQ=?=
    Mar 21, 2006
  2. JerryJ
    Replies:
    11
    Views:
    1,405
    Dave Moore
    Apr 28, 2004
  3. Angus Comber
    Replies:
    7
    Views:
    1,158
    Richard Heathfield
    Feb 5, 2004
  4. manish sahu
    Replies:
    26
    Views:
    1,373
    Nobody
    Jul 12, 2009
  5. Navin
    Replies:
    1
    Views:
    690
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page