Remembering Events

P

Prince

I have a form with an <asp:textbox id="name" /> control.
I then have the TextChanged event wired for it. If a
user modifies any text within the control, the event
fires. Within the event handler, I flag that the text
has been modified.

ex.
bool nameModified = false;

name_TextChanged(....){
nameModified = true;
}

Now when the user presses the UPDATE button, I check the
modified flag for each control and if it is true, I
update the database with the new data. All this works
fine.

Problem:
I also have validation controls on the page. In the
following sequence the problem occurs.

1) User modifies the 'name' textbox -- modified flag set.
2) User clicks into another textbox -- for some reason,
the browser refreshes.

When the page reloads, the nameModified flag is reset to
false, as it should be. However, I don't want it to be
reset to false. I want the page to remember that
the 'name' textbox has already been modified.

How can I make it remember? Better yet, how can I stop
the page from reloading when I click out of a control?

-- Prince
 
P

Prince

While reading other questions, I accidentally came across
the answer.

Solution: remove the AutoPostBack from the control or set
it to "false".

In case someone else had the same problem.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top