Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to increase the height of POP UP Screen using window.open in asp.net with c#. I am not able to do so even after increasing the dialogheight parameter

What I have tried:

My code is as below:
string st = "<script language='JavaScript'> window.open('ViewPDF.aspx" + queryString + "',  'mywindow' ,'dialogWidth:1000px; dialogHeight:500px; center:yes');</script>";
Posted
Updated 15-Dec-20 22:07pm

1 solution

Neither dialogWidth nor dialogHeight are valid attributes for the "window features" string:
Window.open() - Web APIs | MDN[^]

Perhaps you meant width and height instead?

NB: Most browsers will block window.open calls which are not triggered as the direct result of user interaction. You can open a window when the user clicks an element on the page, but you cannot open a window as soon as your page loads.

In ASP.NET, if the user clicks an element which causes a postback, that does not count as user interaction for opening a new window from script returned by the code-behind.

You'll also find that many browsers will open new windows in a new tab rather than a separate window. You will not be able to control the size of the tab, since it will be the same size as the main browser window.
 
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