Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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 :-)[^].

—SA
 
Share this answer
 
v2
Comments
siva0001 21-Feb-12 2:00am    
Thanks a lot for detail explanation.
I placed the base target to self in parent page and window.close() script in dialog page.This works to my requirement.
 
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