By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

How do I check for changes in a user form?

P: n/a
I have a form with several fields (textbox, radio, checkbox), when the user
submits the form I want to check if the user have changed anything.

The check should be performed in the code-behind file.

Is this possible?
/Casper
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
if you want to check using Request.Form[""], you cannot access the default
value.
If you want to perform this check only for server controls, you can have
Changed event handlers for all controls.

for html controls, you have to perform the check on the client side using
script.

Av.

"Casper Skovgaard" <ca**************@hotmail.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a form with several fields (textbox, radio, checkbox), when the user
submits the form I want to check if the user have changed anything.

The check should be performed in the code-behind file.

Is this possible?
/Casper

Nov 18 '05 #2

P: n/a
I only need to check for server controls. I have tried to do the
following:

On the controls I have added a OnTextChanged
<asp:textbox OnTextChanged="OnDocumentChanged"....

And created this method in the code-behind file
private bool IsDocumentChanged;

protected void OnDocumentChanged(object src, EventArgs e)
{
// event handler for all input fields
IsDocumentChanged = true;
}

The problem with that solution is that OnDocumentChanged is first
executed after Page_Load. I need to do one thing when then input is
changed and another thing if the input is not changed. I can't see how to
do that???

/Casper

"avnrao" <av*@newsgroups.com> wrote in
news:Ob**************@TK2MSFTNGP09.phx.gbl:
if you want to check using Request.Form[""], you cannot access the
default value.
If you want to perform this check only for server controls, you can
have Changed event handlers for all controls.

for html controls, you have to perform the check on the client side
using script.

Av.

"Casper Skovgaard" <ca**************@hotmail.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a form with several fields (textbox, radio, checkbox), when the
user
submits the form I want to check if the user have changed anything.

The check should be performed in the code-behind file.

Is this possible?
/Casper



Nov 18 '05 #3

P: n/a
Check for postback in your event handler first, don't set IsDocumentChanged
unless it is a postback.

"Casper Skovgaard" <ca**************@hotmail.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I only need to check for server controls. I have tried to do the
following:

On the controls I have added a OnTextChanged
<asp:textbox OnTextChanged="OnDocumentChanged"....

And created this method in the code-behind file
private bool IsDocumentChanged;

protected void OnDocumentChanged(object src, EventArgs e)
{
// event handler for all input fields
IsDocumentChanged = true;
}

The problem with that solution is that OnDocumentChanged is first
executed after Page_Load. I need to do one thing when then input is
changed and another thing if the input is not changed. I can't see how to
do that???

/Casper

"avnrao" <av*@newsgroups.com> wrote in
news:Ob**************@TK2MSFTNGP09.phx.gbl:
if you want to check using Request.Form[""], you cannot access the
default value.
If you want to perform this check only for server controls, you can
have Changed event handlers for all controls.

for html controls, you have to perform the check on the client side
using script.

Av.

"Casper Skovgaard" <ca**************@hotmail.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a form with several fields (textbox, radio, checkbox), when the
user
submits the form I want to check if the user have changed anything.

The check should be performed in the code-behind file.

Is this possible?
/Casper


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.