Page is dirty information

Discussion in 'ASP .Net Web Controls' started by EDom, Aug 9, 2005.

  1. EDom

    EDom Guest

    Hi,
    On my page I have dataset values displayed in text box and datagrid. After I
    make any change on the text boxes which do not immediately effect the value
    in the dataset. How can I know if the dataset is dirty. I mean how can I
    capture if any change was done to the values in the controls on the page to
    prevent the user from escaping without saving changes

    Regards
    EDom, Aug 9, 2005
    #1
    1. Advertising

  2. You need to capture changed value events, then modify and save the dataset
    before rebinding the controls. Load your old dataset in Page_Load. When the
    TextChanged event fires for your textbox you can either update the dataset
    then or set a flag to do it later. For the datagrid you either handle
    EditItem update events or scavenge the entire datagrid for changed values.
    Then in Page_PreRender you call code to save the changed dataset just before
    binding the controls to their values.

    You probably want to make sure the save succeeds before binding the data;
    I normally just reload dataset right after saving it to make sure, but you
    can do that conditionally if performance matters. BTW I recently read an
    article by Scott Mitchell entitled "Why I Don't Use DataSets in My ASP.NET
    Applications" -- you might want to take a look at it:
    http://aspnet.4guysfromrolla.com/articles/050405-1.aspx

    "EDom" wrote:

    > Hi,
    > On my page I have dataset values displayed in text box and datagrid. After I
    > make any change on the text boxes which do not immediately effect the value
    > in the dataset. How can I know if the dataset is dirty. I mean how can I
    > capture if any change was done to the values in the controls on the page to
    > prevent the user from escaping without saving changes
    >
    > Regards
    >
    >
    >
    Donald Welker, Aug 9, 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. Replies:
    4
    Views:
    522
  2. =?Utf-8?B?U2hhd24=?=

    Set DataGridItem dirty

    =?Utf-8?B?U2hhd24=?=, Sep 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    335
    =?Utf-8?B?U2hhd24=?=
    Sep 7, 2004
  3. EDom

    Page is Dirty information

    EDom, Aug 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    388
    =?Utf-8?B?QW5kcmVhcy5LbnVkc2VuKEFUKWJla2subm8=?=
    Aug 23, 2005
  4. Replies:
    3
    Views:
    1,632
    Bruce Barker
    Mar 20, 2006
  5. DeMarcus

    Is instanceof dirty?

    DeMarcus, Nov 8, 2004, in forum: Java
    Replies:
    26
    Views:
    2,234
    Andrea Desole
    Nov 10, 2004
Loading...

Share This Page