Basic ASP.NET question . . .

L

Lauchlan M

I have an ASP.NET form.

on the page load event, I get some stuff from a db and put the data in some
text boxes, labels, etc. One of these is called, say, Field1 and the value
of Variable1 is put into txtTextBox1.Text. I could also put Field1's value
into a variable, Variable1.

The user can then edit the text boxes such as txtTextBox1. On the form I
have a 'Update changes' button which the user eventually clicks. If
Variable1 has been changed I need to do one thing, if it hasn't I need to do
another.

So the question is how do I best keep track of what in the user edit
controls such as textboxes has been changed on a form after I have clicked a
button (specifically a System.Web.UI.WebControls.Button button).

Since the button click does a postback (I assume!) I imagine I could pass
back a url variable in a query string or have a form hidden field variable,
but even easier than this (if ASP.NET works this way) I could have some sort
of variable that gets remembered serverside between the original first page
load and the postback, and I could just compare the value of the textedit
with the value of this variable, holding the value the textedit was
originally populated with. Does ASP.NET work this way? What is the best way
of checking if a textbox value has been changed since its population and the
postback?

I hope this makes sense . . .

Lauchlan M
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top