Reset button functionality in C#

I am trying to implement the following

Name     Address   ZipCode

x            Jackson    132                 Edit     Reset
(the above data is default)
I make the changes with 'Edit' Button

Name     Address   ZipCode

x            Simpson    456                 Edit     Reset
When i press the 'Reset' Button, i should get the following(should change to the default values)

Name     Address   ZipCode

x            Jackson    132                 Edit     Reset

How do i tackle this one?

Any help is appreciated.  Its urgent

My application is in ASP.NET and C#.

Can i get an example code
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It's not clear how or when this data is loaded into what kind of data structure - are these just fields or a list view or...?

In any case, the principle should be to maintain a set of corresponding variables in your load method that keep the original values, and then to load the values back in the Reset method

private string m_origName,m_origAddress,m_origZip;
private bool m_flg=false;
public void OnLoad(...)
    m_origName = Name.Text;
    m_origAddress = Address.Text;
    m_origZip = Zip.Text;
    m_flg = true; //set flag to indicate we have original values stored

public void OnReset(...)
   Name.Text = m_origName;
   Address.Text = m_origAddress;
   Zip.Text = m_origZip;

Please tell me if this helps
How I do is, make a clone of the object which you have populated. User can change the object, but when he/she presses the reset button, as you have saved the clone copy, populate it once again

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anagmAuthor Commented:
The data(original values) are loaded into a grid, when the page is initialized.

The original values is a record in the database and it is the first record, with description 'default'.

i am using the <itemtemplates> to load the data into the grid
anagmAuthor Commented:
armoghan, can you give an example
You need to implement ICloneable Interface on the object.
see this as a start up

see the reference of IConeable from MSDN

see this example for generic method of cloning.

Now you keep a copy on server side or Session and reset to it when required
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.