Detecting values that have changes on a post back

Discussion in 'ASP .Net' started by Simon Harvey, Apr 28, 2004.

  1. Simon Harvey

    Simon Harvey Guest

    Hi all,

    Is there any easy way to check a field for calues that have changed on a
    post back.

    So the page is sent to the user, the user changes some values and I need to
    know which ones changed.

    Is the only way to do this to go through all the fields and check them
    against their old values. In which case, would I need to store the values in
    the session object so I could tell what the old values were?

    This sounds a bit messy so I'm hoping there is some easier way.

    Any help would be greatfully received

    Thanks everyone

    Simon
    Simon Harvey, Apr 28, 2004
    #1
    1. Advertising

  2. Search on google for "javascript dirty flag", or something similar. Some
    sites use an OnChange attribute in the html input fields, and set a
    variable for each field indicating whether than field has been altered.

    Basically, each field has its own hidden field, with an initial value=0.
    Each input field has its own OnChange event that sets its relative hidden
    field value to 1. When the form posts back you just check the hidden
    fields to see what changed.

    It's not a great solution, but sometimes desirable.

    --
    CharlieN
    VSU

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Note: For the benefit of the community-at-large, all responses to this
    message are best directed to the newsgroup/thread from which they
    originated.
    --------------------
    > From: "Simon Harvey" <>
    > Subject: Detecting values that have changes on a post back
    > Date: Wed, 28 Apr 2004 17:12:32 +0100
    > Lines: 21
    > X-Priority: 3
    > X-MSMail-Priority: Normal
    > X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
    > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
    > Message-ID: <#>
    > Newsgroups: microsoft.public.dotnet.framework.aspnet
    > NNTP-Posting-Host: firewall.the-web-works.co.uk 217.15.160.2
    > Path:

    cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
    .phx.gbl
    > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:229577
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    > Hi all,
    >
    > Is there any easy way to check a field for calues that have changed on a
    > post back.
    >
    > So the page is sent to the user, the user changes some values and I need

    to
    > know which ones changed.
    >
    > Is the only way to do this to go through all the fields and check them
    > against their old values. In which case, would I need to store the values

    in
    > the session object so I could tell what the old values were?
    >
    > This sounds a bit messy so I'm hoping there is some easier way.
    >
    > Any help would be greatfully received
    >
    > Thanks everyone
    >
    > Simon
    >
    >
    >
    Charlie Nilsson [MSFT], Apr 28, 2004
    #2
    1. Advertising

  3. Simon Harvey

    Simon Harvey Guest

    Thanks for that
    Simon Harvey, Apr 29, 2004
    #3
    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. Joby
    Replies:
    0
    Views:
    1,612
  2. Jeremy Chapman
    Replies:
    3
    Views:
    2,460
    Raymond
    Feb 28, 2006
  3. Piotrek \Alchemik\
    Replies:
    0
    Views:
    300
    Piotrek \Alchemik\
    Nov 12, 2006
  4. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    749
    Masudur
    May 25, 2007
  5. Martin
    Replies:
    0
    Views:
    1,203
    Martin
    Apr 28, 2010
Loading...

Share This Page