Click here to Skip to main content
13,139,834 members (56,596 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
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:[^],[^],[^].

See also:[^],[^].

You can choose from more than a million search results: :-)[^].

siva0001 21-Feb-12 2:00am
Thanks a lot for detail explanation.
Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2017
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