How to close a page from code behind [Resolved]

Posted by Nksingh420 under JavaScript on 9/22/2014 | Points: 10 | Views : 1137 | Status : [Member] | Replies : 3
i want to save a page then after save closed page from code behind

condition
1. Its a page not a pop up page
2. use only java script code (ClientScript.RegisterStartupScript not working )




Responses

Posted by: Sheonarayan on: 9/23/2014 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Thanks Naveen,

However, there is slight error in the above code snippet. The last parameter true will not be there as it will write the script tag again. So instead, the correct code snippet that is tested and working fine is below.

Page.ClientScript.RegisterStartupScript(typeof(Page), " Message ", "<script>window.close();</script>");


Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenhcl on: 9/23/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

Use below sample

Page.ClientScript.RegisterStartupScript(typeof(Page), " Message ", "<script>window.close();</script>", true);


Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenhcl on: 9/23/2014 [Member] Starter | Points: 25

Up
0
Down
Yah,

Thanks for correcting me. Keep up with the same efforts. All the Best..

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response