Using asp:HyperLink to open a new window

D

dana lees

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, "DataItem.name") %>'
NavigateUrl='<%# "site.aspx?id=" + DataBinder.Eval
(Container.DataItem,"id").ToString()%>' Target="_blank">
</asp:HyperLink>

The window opens just fine with the parameter (id) i have sent.

The only thing i need is to set the window's properties -
"toolbar=yes;status=no;location=no;menubar=no;width=280,height=520..."

How can i set those properties?

Thanks,
Dana
 
N

newsgroups.comcast.net

dana lees said:
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, "DataItem.name") %>'
NavigateUrl='<%# "site.aspx?id=" + DataBinder.Eval
(Container.DataItem,"id").ToString()%>' Target="_blank">
</asp:HyperLink>

The window opens just fine with the parameter (id) i have sent.

The only thing i need is to set the window's properties -
"toolbar=yes;status=no;location=no;menubar=no;width=280,height=520..."

How can i set those properties?

Thanks,
Dana
You can add .. name="yourwindowname"
onclick="yourwindowname=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');yourwin
downame.focus();return true;" .... somewhere inside the asp:hyperlnk tags
 
N

newsgroups.comcast.net

newsgroups.comcast.net said:
window
You can add .. name="yourwindowname"
onclick="yourwindowname=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');yourwin
downame.focus();return true;" .... somewhere inside the asp:hyperlnk
tags



Forget to say that you should change target="yourwindowname"
Mike
 
V

vMike

newsgroups.comcast.net said:
window
You can add .. name="yourwindowname"
onclick="yourwindowname=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');yourwin
downame.focus();return true;" .... somewhere inside the asp:hyperlnk tags
One other point. the '' after window.open( is 2 single quotes, not a double
quote
 
V

vMike

vMike said:
onclick="yourwindowname=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');yourwin
One other point. the '' after window.open( is 2 single quotes, not a double
quote
oops having a bad day I guess the onclick should read
onclick="somename=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');somenam
e.focus();return true;"

sorry
 
V

vMike

dana lees said:
There is no "onClick" event to the "asp:HyperLink" control...



onclick="yourwindowname=window.open('','yourwindowname','resizable=no,scroll
bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');yourwin
yes but there is an onclick event in html. It just adds a client script to
do the job. you can add not asp events to asp controls too.
 
V

vMike

dana lees said:
There is no "onClick" event to the "asp:HyperLink" control...


in message news:[email protected]...

Try putting this in a aspx file an run it (you may need to fix any wrapping)

<%@ Page %>

<html>
<head>
</head>
<body>
<asp:hyperlink id="zoom1"

onclick="vlarge1=window.open('','vlarge','resizable=no,scrollbars=yes,status
=no,toolbar=no,height=500,width=700,left=50,top=40');vlarge1.focus();return
true;"
onmouseover="window.status='Click here for high quality
picture.';return true"
onmouseout="window.status=''; return true;"
text="View large image"

imageurl="http://us.i1.yimg.com/us.yimg.com/i/ww/bt1/125.gif"
navigateurl = "http://google.com"
target="vlarge"
runat="server"/>
</body>
</html>


Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top