Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 22, 2012 02:34 AM by Chen Yu - MSFT
Member
8 Points
67 Posts
Nov 05, 2012 02:07 PM|LINK
Hi,
I have a content page which contains multiple dropdowns, and textboxes. All those fills in Page_load event.
I want to warn user if the user make any changes and navigates away (not when existing dropdown list's selected Item changes).
Thanks & regards,
Anand
Star
11256 Points
1729 Posts
Nov 05, 2012 02:17 PM|LINK
Try the
onbeforeunload
It also allows you to ask back if the user really wants to leave.
see this demo
alternatively, you can send out an ajax request when he leaves.
Same question discussed here
Nov 05, 2012 02:38 PM|LINK
It even warns when I change any dropdown list selected item in page (as it postbacks). I also have a textbox in the page which fills in page_load() event, alteast can i check whether the value of that textbox has changed?
All-Star
95413 Points
14106 Posts
Nov 05, 2012 04:13 PM|LINK
Search for JQuery Dirty Forms plugins - http://mal.co.nz/code/jquery-dirty-forms/
Thanks,
Nov 07, 2012 01:13 PM|LINK
Never mind I kept all my controls in UdatePanel. It works now.
But it throws "Unspecified error" when I click Cancel button.
21584 Points
2493 Posts
Microsoft
Nov 12, 2012 07:12 AM|LINK
Anand Reddy But it throws "Unspecified error" when I click Cancel button.
Do you have any code to handle cancel_click? If yes, would you please show us some code ? Thanks a lot.
Thanks.
Nov 15, 2012 11:29 AM|LINK
I don't have code to handle Cancle event. If provided any links or sample code to handle Cancle event in javascript will be helpful.
Thanks & Regards,
14076 Points
2794 Posts
Nov 15, 2012 11:39 AM|LINK
Refer this link:
http://www.dotnetvishal.com/2012/11/calling-javascript-using-server-side.html
Nov 16, 2012 07:36 AM|LINK
Anand Reddy If provided any links or sample code to handle Cancle event in javascript will be helpful.
You could use $("#YourButtonID").click(function() {.... } in javascript to handle Cancle event.
Please see: http://www.learningjquery.com/2008/03/working-with-events-part-1
http://api.jquery.com/click/
Nov 21, 2012 08:32 PM|LINK
when I use the javascript function:
window.onbeforeunload = confirmExit;
it fires the confirmExit() function which is in my source file (.aspx)
Here, can I check a textbox value whether it has changed?
Anand Reddy
Member
8 Points
67 Posts
Warn User When navigates away from page without changes
Nov 05, 2012 02:07 PM|LINK
Hi,
I have a content page which contains multiple dropdowns, and textboxes. All those fills in Page_load event.
I want to warn user if the user make any changes and navigates away (not when existing dropdown list's selected Item changes).
Thanks & regards,
Anand
Nasser Malik
Star
11256 Points
1729 Posts
Re: Warn User When navigates away from page without changes
Nov 05, 2012 02:17 PM|LINK
Try the
event: It is fired just before the page is unloadedIt also allows you to ask back if the user really wants to leave.
see this demo
alternatively, you can send out an ajax request when he leaves.
Same question discussed here
Skype: maleknasser1
Anand Reddy
Member
8 Points
67 Posts
Re: Warn User When navigates away from page without changes
Nov 05, 2012 02:38 PM|LINK
It even warns when I change any dropdown list selected item in page (as it postbacks).
I also have a textbox in the page which fills in page_load() event, alteast can i check whether the value of that textbox has changed?
ramiramilu
All-Star
95413 Points
14106 Posts
Re: Warn User When navigates away from page without changes
Nov 05, 2012 04:13 PM|LINK
Search for JQuery Dirty Forms plugins - http://mal.co.nz/code/jquery-dirty-forms/
Thanks,
JumpStart
Anand Reddy
Member
8 Points
67 Posts
Re: Warn User When navigates away from page without changes
Nov 07, 2012 01:13 PM|LINK
Hi,
Never mind I kept all my controls in UdatePanel. It works now.
But it throws "Unspecified error" when I click Cancel button.
Chen Yu - MS...
All-Star
21584 Points
2493 Posts
Microsoft
Re: Warn User When navigates away from page without changes
Nov 12, 2012 07:12 AM|LINK
Hi,
Do you have any code to handle cancel_click? If yes, would you please show us some code ? Thanks a lot.
Thanks.
Feedback to us
Develop and promote your apps in Windows Store
Anand Reddy
Member
8 Points
67 Posts
Re: Warn User When navigates away from page without changes
Nov 15, 2012 11:29 AM|LINK
Hi,
I don't have code to handle Cancle event. If provided any links or sample code to handle Cancle event in javascript will be helpful.
Thanks & Regards,
Anand
geniusvishal
Star
14076 Points
2794 Posts
Re: Warn User When navigates away from page without changes
Nov 15, 2012 11:39 AM|LINK
Refer this link:
http://www.dotnetvishal.com/2012/11/calling-javascript-using-server-side.html
My Website
www.dotnetvishal.com
Chen Yu - MS...
All-Star
21584 Points
2493 Posts
Microsoft
Re: Warn User When navigates away from page without changes
Nov 16, 2012 07:36 AM|LINK
Hi,
You could use $("#YourButtonID").click(function() {.... } in javascript to handle Cancle event.
Please see: http://www.learningjquery.com/2008/03/working-with-events-part-1
http://api.jquery.com/click/
Thanks.
Feedback to us
Develop and promote your apps in Windows Store
Anand Reddy
Member
8 Points
67 Posts
Re: Warn User When navigates away from page without changes
Nov 21, 2012 08:32 PM|LINK
Hi,
when I use the javascript function:
window.onbeforeunload = confirmExit;
it fires the confirmExit() function which is in my source file (.aspx)
Here, can I check a textbox value whether it has changed?
Thanks & Regards,
Anand