473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Check Form controls have changed

Hello, I have a asp.net page with a form with 15 textboxes and a
couple of dropdownlists....I want to know if their is a way
(...serverside please...) of checking if any change has been made to
any of these controls before I send and update to the database....I
would rather not have a OnTextChanged & OnSelectedItemChanged with
postback set to false for every control on the page...

I have been trying to implement the IPostBackEventHandler in the page
System.Web.UI.Page, IPostBackEventHandler

and then override methods in it, but I think this is mostly for
customcontrols

public override void RaisePostBackEvent( IPostBackEventHandler
sourceControl, string eventArgument)
{
Response.Write( "<b>This is the RaisePostBackEvent event.</b><br>" );
}

public virtual void RaisePostDataChangedEvent()
{
Response.Write( "<b>This is the RaisePostDataChangedEvent");
}

public virtual bool LoadPostData(string postDataKey,
NameValueCollection postCollection)
{
string presentValue = _text;
string postedValue = postCollection[postDataKey];

if (!presentValue.Equals(postedValue))
{
_text = postedValue;
return true;
}
return false;
}
Nov 19 '05 #1
2 1474
You could save the original value as a custom attribute and later retrieve
it to compare with what was posted back.
Hope this helps.
--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>

"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
Hello, I have a asp.net page with a form with 15 textboxes and a
couple of dropdownlists....I want to know if their is a way
(...serverside please...) of checking if any change has been made to
any of these controls before I send and update to the database....I
would rather not have a OnTextChanged & OnSelectedItemChanged with
postback set to false for every control on the page...

I have been trying to implement the IPostBackEventHandler in the page
System.Web.UI.Page, IPostBackEventHandler

and then override methods in it, but I think this is mostly for
customcontrols

public override void RaisePostBackEvent( IPostBackEventHandler
sourceControl, string eventArgument)
{
Response.Write( "<b>This is the RaisePostBackEvent event.</b><br>" );
}

public virtual void RaisePostDataChangedEvent()
{
Response.Write( "<b>This is the RaisePostDataChangedEvent");
}

public virtual bool LoadPostData(string postDataKey,
NameValueCollection postCollection)
{
string presentValue = _text;
string postedValue = postCollection[postDataKey];

if (!presentValue.Equals(postedValue))
{
_text = postedValue;
return true;
}
return false;
}

Nov 19 '05 #2
Thanks for the recommendation....perhaps a custom attribute for the
whole form, maybe a comma delimited string of previous values...

However I do have a multiline textbox, so there could be alot of data
to append.

This seems so obvious that there should be ControlCollection.isDirty or
..Changed...

I don't know how to get to it as RaiseChangedEvents is private....

Maybe I will go apeshit and disassembly the System.Web.UI dll and make
that method overrideable....

hmmm...ideas...ideas....performance-wise unknown..
Gopal (FMS, Inc.) wrote:
You could save the original value as a custom attribute and later retrieve it to compare with what was posted back.
Hope this helps.
--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>

"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
Hello, I have a asp.net page with a form with 15 textboxes and a
couple of dropdownlists....I want to know if their is a way
(...serverside please...) of checking if any change has been made to any of these controls before I send and update to the database....I
would rather not have a OnTextChanged & OnSelectedItemChanged with
postback set to false for every control on the page...

I have been trying to implement the IPostBackEventHandler in the page System.Web.UI.Page, IPostBackEventHandler

and then override methods in it, but I think this is mostly for
customcontrols

public override void RaisePostBackEvent( IPostBackEventHandler
sourceControl, string eventArgument)
{
Response.Write( "<b>This is the RaisePostBackEvent event.</b><br>" ); }

public virtual void RaisePostDataChangedEvent()
{
Response.Write( "<b>This is the RaisePostDataChangedEvent");
}

public virtual bool LoadPostData(string postDataKey,
NameValueCollection postCollection)
{
string presentValue = _text;
string postedValue = postCollection[postDataKey];

if (!presentValue.Equals(postedValue))
{
_text = postedValue;
return true;
}
return false;
}


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lauren Quantrell | last post by:
In terms of resources, wondering if it makes a difference in adopting one of the three options below for resizing controls on a form and controls on a subform at the same time. option a.) Put...
10
by: Rob Meade | last post by:
Hi all, I've got myself into a bit of a problem and I'm trying to dig my way back out, in a) the quickest way due to project deadline and also b) best approach. I have a form which gets a set...
1
by: Jaime Stuardo | last post by:
Hi all.... I am programming in ASP.NET 2.0 and VS.NET 2005 Beta 2. I have a MasterPage that provides basic look & feel for my pages. The main form present in the master page has this...
1
by: Adam Right | last post by:
Hi, I want to get the controls of the windows form. I know that form.Controls give me the list of controls but i have a problem. For example, the toolstripmenu control cannot be reached with...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
17
by: olivero | last post by:
Hi group, How do I check all check box controls on a Continuous Form? I have a form (Main) with two SubForms (Sub1 and Sub2). Sub1 has a button that is supposed to check all the check boxes...
11
by: dhtml | last post by:
(originally mis-posted on m.p.s.jscript...) I've just closed all windows in Firefox and its using 244MB of memory. I have no idea why. I had GMail open, a page from unicode, the CLJ FAQ. ...
10
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.