Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have one aspx page which has different parts like PartA, PartB, PartC, PartD. Each part has different data showed in text boxes. There is one Save button which will save the entire page data to the database.

If user doesn't change any thing on page and press "Save" button, need to show the popup showing that "No changes happen"

What Approach should be the best?

Thanks
Posted

One option is to store the existing data in javascript variables and when form is submitted, compare the data. If the data is same then show alert box to user.

Another option is to use hidden fieldand comparing the data.

you can also submit the form and do the comparision and show the message instead of alert (but this will need a server trip).
 
Share this answer
 
Comments
Ashishmau 11-May-11 5:00am    
i also think same
Hi Laxmikant,
javascript is the answer to your question ;)
Step 1) Save all the value of textboxes in hiddefield say value of txtbox1 in hdntxtbox1
Step2)
a. Write a unique javascript function say ISdatachange(agr) on the onchange event of all the text box
b. check is the value of corresponding textbox is same as that of its corresponding hiddenfield if not change the value of some globalvariable say _GblVar to 1 if its zero

Step 3)On click of save button check if _GblVar value is 1 show the alert else not.

Hope this will help you let me know if you need any clarification :)

Enjoy Life ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900