Form state change

  • Thread starter Thread starter Anatoli Trifonov
  • Start date Start date
A

Anatoli Trifonov

Hi.

This is probably easy but I can't find solution so far.

I have a web form with several text boxes.
System.Web.UI.WebControls.TextBox
One submit button
System.Web.UI.WebControls.Button
When button is clicked form submitts fine.
I need to know if used changed any of the textboxes wihtout any specific
events to any of textboxes.
I know I can save the old values and then compare but is not there something
automatic in ASP.Net to track that?

Thanks.
AT
 
Hi,

I'm not sure what you mean about "without any specific events to any of
textboxes". The TextBox server controls has a TextChanged event that you
can hook up to every text box. One event can cover all text boxes if you
have them all handled by the same event. Other than that you'll have to use
javascript and a hidden field.

<input type="hidden" id="hidChanged" name="hidChanged" runat="server">

Set this to 0. Then for each textbox:

TextBox1.Attributes.Add("onkeydown",
"document.GetElementById('hidChanged').value = 0;")

Then on your post back check if hidChanged.Value still equals 0. Good luck!
Ken.
 
Back
Top