Print Page | Close Window

Opening New Window

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12492
Printed Date: 29 March 2026 at 2:09pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Opening New Window
Posted By: Misty
Subject: Opening New Window
Date Posted: 11 November 2004 at 2:15am

I used the following code:

 

 

<%# IIF(FieldValueIsMissing(Databinder.Eval(Container.DataItem, "WebSite")), "", "<a href=''onclick='OpenNewWindow(""" & DataBinder.Eval (Container.DataItem, "WebSite") & """)'>Go To Web Site</a>")%>

 

 

There's a problem with the bolded part. This is strange, but it shows the web site address that it is on instead of the actual web site address that comes from the database. For example, if this listing is on http://www.webwiz.net/forum.asp - http://www.webwiz.net/forum.asp , it will show http://www.webwiz.net - http://www.webwiz.net instead of the web site address from the database. Let's say that the web site address from the database is http://www.yourwebsite.com - http://www.yourwebsite.com . It will not show that web site address. Can someone please help me with this?




Replies:
Posted By: Mart
Date Posted: 11 November 2004 at 2:56am
Try changing the bold bit to:

onclick=""OpenNewWindow('" & DataBinder.Eval (Container.DataItem, "WebSite") & "');""


Posted By: Misty
Date Posted: 11 November 2004 at 4:42pm
I tried <%# IIF(FieldValueIsMissing(Databinder.Eval(Container.DataItem, "WebSite")), "", "<a href=onclick=""OpenNewWindow('" & DataBinder.Eval (Container.DataItem, "WebSite") & "');""Go To Web Site</a>")%>. It will not show the web site address anymore. The web site address exists. Can someone please help me with this?


Posted By: Mart
Date Posted: 11 November 2004 at 4:58pm
try what I said...

you are going <A href=onclick="..."> which is not how you do it... btw If you  only want to open it in a new window why don't you just use target="_black" on the hyperlink tag?


Posted By: Misty
Date Posted: 11 November 2004 at 5:16pm

I tried using "<a href="target="_black" & DataBinder.Eval (Container.DataItem, "WebSite") & "'>Go To Web Site</a>")%>, but it would not work. I am lost on this. I am still getting used to the syntax in ASP.net.

I just want to be able to open the web site that comes from the database in a new window.

 



Posted By: Mart
Date Posted: 11 November 2004 at 5:33pm
eek partly my fault for mis spelling blank but it should be

<a href="http://www.yoururl.com">Your Text</a>

so you would need

"<a href=""" & DataBinder.Eval (Container.DataItem, "WebSite") & """>Go to website</a>"


Posted By: Misty
Date Posted: 12 November 2004 at 1:02pm
I had to use <%# IIF(FieldValueIsMissing(Databinder.Eval(Container.DataItem, "WebSite")), "", "<a href='" & DataBinder.Eval (Container.DataItem, "WebSite") & "' target='_blank'>Go to website</a>")%> to get it working.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net