By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.