473,385 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to open a web form in new IE window on clicking hyperlink with NO scrollbars, status bar and toolbar?

I am using asp .net 2.0. I have a hyperlink asp control on my web page
page1.aspx.
On clicking this hyper;link, I would like to open page2.aspx (which is
in the same web application) in a new IE window without scrollbars,
status bar, tool bar and with specified height and width.
Can it be done on "onload" event of the page2.aspx in javascript?

Jun 7 '06 #1
9 2843
You need to open the page with a javascript call to window.showModalDialog
function. Look up the MSDN info on this function, you will find how to
specify the scrollbars and other parameters.

For the hyperlink, specify url as javascript:showModalDialog(...)

Eliyahu

"loga123" <vd**********@covansys.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
I am using asp .net 2.0. I have a hyperlink asp control on my web page
page1.aspx.
On clicking this hyper;link, I would like to open page2.aspx (which is
in the same web application) in a new IE window without scrollbars,
status bar, tool bar and with specified height and width.
Can it be done on "onload" event of the page2.aspx in javascript?

Jun 7 '06 #2
Hi,

Eliyahu Goldin wrote:
You need to open the page with a javascript call to window.showModalDialog
function. Look up the MSDN info on this function, you will find how to
specify the scrollbars and other parameters.

For the hyperlink, specify url as javascript:showModalDialog(...)

Eliyahu


Using javascript: is a bad idea and can lead to problems on some
platforms. It's much more elegant to use the following construct:

<a href="nojs.html" onclick="doSomething();return false;">Click</a>

The advantage of this is that the onclick even won't be executed if
JavaScript is not present or deactivated, and the link will degrade
gracefully and lead the use to a page (nojs.html) explaining why the
experience would be better with JavaScript.

Besides, showModalDialog is IE only, so using window.open() with a set
of chosen features is a better choice. Since the OP doesn't need the
window to stay in front (modal), the window.open method is enough.

More info here:
http://developer.mozilla.org/en/docs/DOM:window.open
and
http://msdn.microsoft.com/workshop/a...ods/open_0.asp

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 7 '06 #3
Hi,

loga123 wrote:
I am using asp .net 2.0. I have a hyperlink asp control on my web page
page1.aspx.
On clicking this hyper;link, I would like to open page2.aspx (which is
in the same web application) in a new IE window without scrollbars,
status bar, tool bar and with specified height and width.
Can it be done on "onload" event of the page2.aspx in javascript?


No, a page cannot modify it's own features for security reasons. You
must specifiy the features when you open the window. See my reply to
Eliyahu in this same thread for details.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 7 '06 #4
Laurent,

I can only wish you luck in programming in asp.net without javascript. Can I
ask if you are aware of any non-javascript asp.net project that would
satisfy the customers?

The OP's requirements made me think of a dialog window.

Eliyahu
"Laurent Bugnion" <lb******@bluewin.ch> wrote in message
news:44**********@news.bluewin.ch...
Hi,

Eliyahu Goldin wrote:
You need to open the page with a javascript call to
window.showModalDialog function. Look up the MSDN info on this function,
you will find how to specify the scrollbars and other parameters.

For the hyperlink, specify url as javascript:showModalDialog(...)

Eliyahu


Using javascript: is a bad idea and can lead to problems on some
platforms. It's much more elegant to use the following construct:

<a href="nojs.html" onclick="doSomething();return false;">Click</a>

The advantage of this is that the onclick even won't be executed if
JavaScript is not present or deactivated, and the link will degrade
gracefully and lead the use to a page (nojs.html) explaining why the
experience would be better with JavaScript.

Besides, showModalDialog is IE only, so using window.open() with a set of
chosen features is a better choice. Since the OP doesn't need the window
to stay in front (modal), the window.open method is enough.

More info here:
http://developer.mozilla.org/en/docs/DOM:window.open
and
http://msdn.microsoft.com/workshop/a...ods/open_0.asp

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jun 7 '06 #5
Hi,

Eliyahu Goldin wrote:
Laurent,

I can only wish you luck in programming in asp.net without javascript. Can I
ask if you are aware of any non-javascript asp.net project that would
satisfy the customers?

The OP's requirements made me think of a dialog window.

Eliyahu


Oh no, believe me, I love JavaScript and use it often. I didn't say you
shouldn't use JavaScript, I said you shouldn't use "javascript:" as in
the javascript: pseudo protocol. Sorry I was not being clear.

The OP's requirement are for a pop-up with specific features. This is
fulfilled by a modal window, but when ever possible, I try to show the
browser compatible way to do things in JavaScript. showModelDialog being
IE only, I wanted to indicate a more compatible way to do things.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 7 '06 #6
Thanks for the reply.

I am using server side (as.net control, not just the anchor tag from
html) hyperlink control in my application.
And...."navigateURL" property for this hyperlink is set dynamically in
my code behind page.
In such scenario....how can I open a new window w/o scroll bars,
toolbar, status bar etc...?
Laurent Bugnion wrote:
Hi,

Eliyahu Goldin wrote:
You need to open the page with a javascript call to window.showModalDialog
function. Look up the MSDN info on this function, you will find how to
specify the scrollbars and other parameters.

For the hyperlink, specify url as javascript:showModalDialog(...)

Eliyahu


Using javascript: is a bad idea and can lead to problems on some
platforms. It's much more elegant to use the following construct:

<a href="nojs.html" onclick="doSomething();return false;">Click</a>

The advantage of this is that the onclick even won't be executed if
JavaScript is not present or deactivated, and the link will degrade
gracefully and lead the use to a page (nojs.html) explaining why the
experience would be better with JavaScript.

Besides, showModalDialog is IE only, so using window.open() with a set
of chosen features is a better choice. Since the OP doesn't need the
window to stay in front (modal), the window.open method is enough.

More info here:
http://developer.mozilla.org/en/docs/DOM:window.open
and
http://msdn.microsoft.com/workshop/a...ods/open_0.asp

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch


Jun 7 '06 #7
Hi,

loga123 wrote:
Thanks for the reply.

I am using server side (as.net control, not just the anchor tag from
html) hyperlink control in my application.
And...."navigateURL" property for this hyperlink is set dynamically in
my code behind page.
In such scenario....how can I open a new window w/o scroll bars,
toolbar, status bar etc...?


<asp:HyperLink
Runat="server"
ID="lnkOpenWindow"
Text="Open window" />

and then on Page_Load

lnkOpenWindow.NavigateUrl = "nojs.html";
lnkOpenWindow.Attributes[ "onclick" ]
= "window.open( 'http://www.galasoft-lb.ch', 'popUpName', "
+ "'width=500,height=300,screenX=50,screenY=100,left =50,top=100');"
+ "return false;";

This will open a new window without any chromes if JavaScript is
enabled. screenX and screenY are for Mozilla, left and top are for IE,
so both must be set.

If JavaScript is disabled, this navigates to a page named nojs.html
where you can explain why the user experience is so much better with
JavaScript ;-)

Also: this works because the default value for chromes (status bar,
location bar, etc...) is set to "no". If you want to show only the
status bar, for example, you must set it explicitly to "yes".

See
http://developer.mozilla.org/en/docs/window.open
for details.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 7 '06 #8
Hi Laurent ,

Thanks for your reply.
I tried with the solution you have. It gives me an error when I click
on the hyperlink.
Error says " Invalid argument".
And arguments for manipulating window features do not seem to work.
I am using IE.

Can you help me on this? It's really urgent for me.

Laurent Bugnion wrote:
Hi,

loga123 wrote:
Thanks for the reply.

I am using server side (as.net control, not just the anchor tag from
html) hyperlink control in my application.
And...."navigateURL" property for this hyperlink is set dynamically in
my code behind page.
In such scenario....how can I open a new window w/o scroll bars,
toolbar, status bar etc...?


<asp:HyperLink
Runat="server"
ID="lnkOpenWindow"
Text="Open window" />

and then on Page_Load

lnkOpenWindow.NavigateUrl = "nojs.html";
lnkOpenWindow.Attributes[ "onclick" ]
= "window.open( 'http://www.galasoft-lb.ch', 'popUpName', "
+ "'width=500,height=300,screenX=50,screenY=100,left =50,top=100');"
+ "return false;";

This will open a new window without any chromes if JavaScript is
enabled. screenX and screenY are for Mozilla, left and top are for IE,
so both must be set.

If JavaScript is disabled, this navigates to a page named nojs.html
where you can explain why the user experience is so much better with
JavaScript ;-)

Also: this works because the default value for chromes (status bar,
location bar, etc...) is set to "no". If you want to show only the
status bar, for example, you must set it explicitly to "yes".

See
http://developer.mozilla.org/en/docs/window.open
for details.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch


Jun 8 '06 #9
Hi Laurent,

Thanks a bunch....it works like a charm :-)
I was having ")" after " return false;" and that was causing problem.
I corrected it now.

Thanks again
loga123 wrote:
Hi Laurent ,

Thanks for your reply.
I tried with the solution you have. It gives me an error when I click
on the hyperlink.
Error says " Invalid argument".
And arguments for manipulating window features do not seem to work.
I am using IE.

Can you help me on this? It's really urgent for me.

Laurent Bugnion wrote:
Hi,

loga123 wrote:
Thanks for the reply.

I am using server side (as.net control, not just the anchor tag from
html) hyperlink control in my application.
And...."navigateURL" property for this hyperlink is set dynamically in
my code behind page.
In such scenario....how can I open a new window w/o scroll bars,
toolbar, status bar etc...?


<asp:HyperLink
Runat="server"
ID="lnkOpenWindow"
Text="Open window" />

and then on Page_Load

lnkOpenWindow.NavigateUrl = "nojs.html";
lnkOpenWindow.Attributes[ "onclick" ]
= "window.open( 'http://www.galasoft-lb.ch', 'popUpName', "
+ "'width=500,height=300,screenX=50,screenY=100,left =50,top=100');"
+ "return false;";

This will open a new window without any chromes if JavaScript is
enabled. screenX and screenY are for Mozilla, left and top are for IE,
so both must be set.

If JavaScript is disabled, this navigates to a page named nojs.html
where you can explain why the user experience is so much better with
JavaScript ;-)

Also: this works because the default value for chromes (status bar,
location bar, etc...) is set to "no". If you want to show only the
status bar, for example, you must set it explicitly to "yes".

See
http://developer.mozilla.org/en/docs/window.open
for details.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch


Jun 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
7
by: Anna | last post by:
Hi all. I have a (hopefully) pretty simple question. I open a link in a new window: <a href="http://www.somewhere.com/some.hml"...
2
by: venkatesh | last post by:
Hi Members, I have used the below mentioned code to open a html page in a new browser. The window size is 200 x 300. In that browser, I've given code to open another browser of the same size....
4
by: KenG | last post by:
Hi: I have a datagrid that builds a hyperling which uses javascript to open a new window. The new window opens and displays fine, however, the original window that has the grid, is now blank...
9
by: dana lees | last post by:
Hello, I am using asp:HyperLink in a c# asp.net application to open a new window in the following way: <asp:HyperLink ID="lnkSiteName" runat="server" Text='<%# DataBinder.Eval(Container,...
1
by: Socrates | last post by:
Hi - Have tried for half and hour to get this script to work: I am trying to close the parent window while opening a centred new child window I would be grateful if someone could correct the...
5
by: Vinutha | last post by:
Hi, How to open small window when i click Command Button or Command link in a webpage. Thanks, Vinutha.
4
by: jonniethecodeprince | last post by:
Hey guys, I've been poking through w3schools using their online code tryout pages. I started having fun manipulating browser pages in new windows. I figured out how to open a new window with a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.