Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: NET
Hi friends,
 
Please help me to write C# code   for following secenario,
 
I have created the aspx page and used master page in it.From this page on clicking View i navigated to Modal Dialog page.
 
i have back button in dialog page.When i click i want to close this page so i tried window.close().It opened another page and asked whether to close or not.
 
Please guide me to how to close the modal dialog page?
 
Thanks in advance.
Posted 20-Feb-12 6:21am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

First, if the dialog box is truly modal, it should not have a "back" button. The modal behavior means that you should work only with one dialog, not other windows, complete the work, and close it; when you close it, you will be on the same page anyway. So, the dialog box can have a "Close" button or "OK" (which I don't like, because — what is OK?), along with others like "Cancel".
 
Strictly speaking, strongly modal behavior is not possible with Web applications because you can always create any number of Web browser's windows with the same URI and switch to them having a modal dialog box open, so your application should handle such cases. Your application should suggest the user to work with only one window and use modal behavior where required but be prepare to handle the situations when the user does something different.
 
I would recommend to use jQuery for modal dialog or a modal window. There is a big number of components around. To get a pretty good idea, look at these three:
http://jqueryui.com/demos/dialog/[^],
http://jquery.com/demo/thickbox/[^],
http://www.queness.com/resources/html/modal/jquery-modal-window.html[^].
 
See also:
http://en.wikipedia.org/wiki/JQuery[^],
http://docs.jquery.com/Main_Page[^].
 
You can choose from more than a million search results: http://bit.ly/z5A3TB Smile | :) [^].
 
—SA
  Permalink  
v2
Comments
siva0001 at 21-Feb-12 2:00am
   
Thanks a lot for detail explanation.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I placed the base target to self in parent page and window.close() script in dialog page.This works to my requirement.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 305
1 _Amy 235
2 Peter Leow 205
3 Andreas Gieriet 180
4 Dave Kreskowiak 130
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,412
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100