Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 08, 2009 06:45 AM by meharooftp
Member
7 Points
45 Posts
Sep 25, 2007 09:55 PM|LINK
Hi
I need to open a hyperlink in new window and I am using Target="_blank". It is opening new window but with browser tools and buttons.
My question: How do I open just new window without any tools or buttons displayed and the size of the form should be width 300px and height 200px?
Star
9551 Points
1391 Posts
Sep 26, 2007 01:30 AM|LINK
window.open('URL','left=20,top=20,width=300,height=200,toolbar=0,resizable=0');
Also see this as a reference http://www.javascripter.net/faq/openinga.htm
Sep 26, 2007 09:28 AM|LINK
I have tried the below
<
Any idea where I am making mistake ??
Sep 26, 2007 09:45 AM|LINK
<asp:Hyperlink Runat="server" NavigateUrl="images/UC.pdf" onclick="window.open (this.href, 'popupwindow', 'width=400,height=400,scrollbars,resizable'); return false;">Link text goes here<asp:Hyperlink>
Also follow this thread http://forums.asp.net/p/1137195/1819553.aspx
366 Points
87 Posts
Sep 26, 2007 09:47 AM|LINK
Hi,
You shouldn't use the NavigateUrl property of the HyperLink control. This is a server side property.
On the Page Load event, try this: newWindow.Attributes.Add("onClick","window.open(images/UC.pdf','','width=400,height=400');");
Regards,
Tushar
Sep 26, 2007 10:15 AM|LINK
Sorry for hassle.
Error : Onclick is not valid for asp.net.
Also I have tried the below one
It is opening the popup window but the parent browser become blank and only display as [object]
All-Star
34797 Points
2497 Posts
Sep 28, 2007 07:21 AM|LINK
SudhaYogesh Error : Onclick is not valid for asp.net. Also I have tried the below one <asp:HyperLink ID="newtestWindow" Runat="server" NavigateUrl="javascript:w= window.open('test.aspx','mywin','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');" >new Window</asp:HyperLink> It is opening the popup window but the parent browser become blank and only display as [object]
Hi SudhaYogesh,
Actually onclick is available for HyperLink control. Please understand that it is case-sensitive. You can use the following code to achieve the goal.
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="removethis#" onclick="javascript:w= window.open('test.aspx','mywin','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');">new Window</asp:HyperLink> </div> </form> </body> </html>
Sep 29, 2007 07:04 PM|LINK
Thank you very much. It works but is there anyway to use the below url inside the onclick command
<%# "http://somedomain/ImageResizeCache/productImages/Pack/" + Eval("Imageurl")+ ".jpg"%>
I am triyng to open the image in new window from the gridviw
6 Points
13 Posts
Jan 08, 2009 06:45 AM|LINK
You can do it from inside Gridview item template as follows:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("http://somedomain/ImageResizeCache/productImages/Pack/{0}.jpg",Eval("Imageurl"))%>' onclick="javascript:w= window.open(this.href,'Download Image','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');return false;">Download</asp:HyperLink>
SudhaYogesh
Member
7 Points
45 Posts
How to open hyperlink in new window without any tools displayed?
Sep 25, 2007 09:55 PM|LINK
Hi
I need to open a hyperlink in new window and I am using Target="_blank". It is opening new window but with browser tools and buttons.
My question: How do I open just new window without any tools or buttons displayed and the size of the form should be width 300px and height 200px?
HosamKamel
Star
9551 Points
1391 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 26, 2007 01:30 AM|LINK
window.open('URL','left=20,top=20,width=300,height=200,toolbar=0,resizable=0');Remember to click on Mark as answer on the post that helped you
SudhaYogesh
Member
7 Points
45 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 26, 2007 09:28 AM|LINK
Hi
I have tried the below
<
asp:HyperLink ID="newWindow" Runat="server" NavigateUrl="javascript:w=window.open(images/UC.pdf','','width=400,height=400');" >new Window</asp:HyperLink>Any idea where I am making mistake ??
HosamKamel
Star
9551 Points
1391 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 26, 2007 09:45 AM|LINK
Remember to click on Mark as answer on the post that helped you
er.tushar
Member
366 Points
87 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 26, 2007 09:47 AM|LINK
Hi,
You shouldn't use the NavigateUrl property of the HyperLink control. This is a server side property.
On the Page Load event, try this:
newWindow.Attributes.Add("onClick","window.open(images/UC.pdf','','width=400,height=400');");
Regards,
Tushar
Tushar
HRStop.com - A web based hosted HR Management System.
Beejak.com - A web based hosted Online Invoicing and Billing Software
SudhaYogesh
Member
7 Points
45 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 26, 2007 10:15 AM|LINK
Hi
Sorry for hassle.
Error : Onclick is not valid for asp.net.
Also I have tried the below one
<
asp:HyperLink ID="newtestWindow" Runat="server" NavigateUrl="javascript:w= window.open('test.aspx','mywin','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');" >new Window</asp:HyperLink>It is opening the popup window but the parent browser become blank and only display as [object]
Benson Yu - ...
All-Star
34797 Points
2497 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 28, 2007 07:21 AM|LINK
Hi SudhaYogesh,
Actually onclick is available for HyperLink control. Please understand that it is case-sensitive. You can use the following code to achieve the goal.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="
removethis#" onclick="javascript:w= window.open('test.aspx','mywin','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');">new Window</asp:HyperLink></div>
</form>
</body>
</html>
Benson Yu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
SudhaYogesh
Member
7 Points
45 Posts
Re: How to open hyperlink in new window without any tools displayed?
Sep 29, 2007 07:04 PM|LINK
Hi
Thank you very much. It works but is there anyway to use the below url inside the onclick command
<%# "http://somedomain/ImageResizeCache/productImages/Pack/" + Eval("Imageurl")+ ".jpg"%>
I am triyng to open the image in new window from the gridviw
meharooftp
Member
6 Points
13 Posts
Re: How to open hyperlink in new window without any tools displayed?
Jan 08, 2009 06:45 AM|LINK
You can do it from inside Gridview item template as follows:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("http://somedomain/ImageResizeCache/productImages/Pack/{0}.jpg",Eval("Imageurl"))%>' onclick="javascript:w= window.open(this.href,'Download Image','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');return false;">Download</asp:HyperLink>