Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I check for changes in a user form?

Reply
Thread Tools

How do I check for changes in a user form?

 
 
Casper Skovgaard
Guest
Posts: n/a
 
      05-06-2004
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
 
Reply With Quote
 
 
 
 
avnrao
Guest
Posts: n/a
 
      05-06-2004
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" <(E-Mail Removed)> wrote in message
news:Xns94E164DA7A3FDcasperskovgaardhotma@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



 
Reply With Quote
 
 
 
 
Casper Skovgaard
Guest
Posts: n/a
 
      05-06-2004
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" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> 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" <(E-Mail Removed)> wrote in message
> news:Xns94E164DA7A3FDcasperskovgaardhotma@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

>
>
>


 
Reply With Quote
 
Rick Spiewak
Guest
Posts: n/a
 
      05-06-2004
Check for postback in your event handler first, don't set IsDocumentChanged
unless it is a postback.

"Casper Skovgaard" <(E-Mail Removed)> wrote in message
news:Xns94E175D6E41CFcasperskovgaardhotma@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" <(E-Mail Removed)> wrote in
> news:(E-Mail Removed):
>
> > 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" <(E-Mail Removed)> wrote in message
> > news:Xns94E164DA7A3FDcasperskovgaardhotma@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

> >
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check whether user put a check in a toolbox CheckBox contro JB ASP .Net 1 08-26-2009 11:18 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Check form before unload for changes Assimalyst ASP .Net 2 08-11-2005 09:48 AM
How does ASP.NET check for changes to aspx files ? Joseph Farmer ASP .Net 5 06-02-2005 12:57 AM
Check for form changes JIK ASP .Net 4 02-07-2004 10:58 PM



Advertisments