I have been trying this from hours that I am opening a new window and I am bound to launch from code behind so it is not opening in new tab. I want to adjust the height and width of this window, but I am unable to set the same. I also tried calling a javascript function from code behind and writing the same in aspx page, but no luck.
I am posting my code: From Code behind:
Page.ClientScript.RegisterStartupScript(typeof(string), scriptKey, "<script type='text/javascript'>window.open('../ReportWebForm.aspx?ReportType=Report','height=50,width=2000,left=0px,top=0px,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');</script>");
if I launch from server by calling aspx page javascript:
function OpenWindow() {
window.parent.open('../ReportWebForm.aspx?ReportType=Report', 'width = 100%, height = 100%');
}
I have been trying this from hours that I am opening a new window and I am bound to launch from code behind so it is not opening in new tab. I want to adjust the height and width of this window, but I am unable to set the same. I also tried calling a javascript function from code behind and writing the same in aspx page, but no luck.
I am posting my code: From Code behind:
Page.ClientScript.RegisterStartupScript(typeof(string), scriptKey, "<script type='text/javascript'>window.open('../ReportWebForm.aspx?ReportType=Report','height=50,width=2000,left=0px,top=0px,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');</script>");
if I launch from server by calling aspx page javascript:
function OpenWindow() {
window.parent.open('../ReportWebForm.aspx?ReportType=Report', 'width = 100%, height = 100%');
}
Share
Improve this question
asked May 14, 2013 at 13:04
Iti TyagiIti Tyagi
3,6818 gold badges51 silver badges80 bronze badges
2 Answers
Reset to default 3Try this
note 2nd parameter is name of window. the height and width you need to give in 3rd parameter
function OpenWindow() {
window.open('../ReportWebForm.aspx?ReportType=Report','', 'width = 100, height = 100');
}
You can try this.
<a href="javascript:;" style="color:#000" onClick="window.open('printreport3.php','msgWindow','toolbar=no, scrollbars=yes, resizable=no, top=30, left=100, width=1000, height=auto')"> Print View </a>
you have to set scrollbar to yes. scrollbars=yes