Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 17th, 2006, 05:11 PM
Authorized User
Join Date: Jun 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default simple wish: to add 'http://' to a HyperLink

Hello, I am trying to add 'http://www' to a database value.

My idea for the code is like this:

<asp:HyperLink ID="website" runat="server" NavigateUrl='http://www. + '<%# Bind("Website") %>''></asp:HyperLink>

but its no good! Can anyone help please?

Old June 21st, 2006, 08:41 AM
Registered User
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Hi bananas. Try this:
NavigateUrl='<% # "http://www." & eval("Website")%>'>HyperLink text</asp:HyperLink>

if you want to print the web address as your link text then:

<asp:HyperLink ID="HyperLink1" runat="server" Style="position: static" NavigateUrl='<% # "http://www." & eval("Website")%>'> <asp:Label ID="WebsiteLabel" runat="server" Text='<%# Bind("Website") %>'></asp:Label></asp:HyperLink><br />

And just in case you're wondering: yes, email would work the same way:

<asp:HyperLink ID="HyperLink2" runat="server" Style="position: static" NavigateUrl='<% # "mailto:" & eval("Email")%>'> <asp:Label ID="EmailLabel" runat="server" Text='<%# Bind("Email") %>'></asp:Label></asp:HyperLink><br />

Similar Threads
Thread Thread Starter Forum Replies Last Post
typing abc.com opens http://abc.com and not http:/ nrlahoti ASP.NET 2.0 Professional 1 February 6th, 2008 01:43 PM
Chapter 26 Simple HTTP Module Not Showing In Sourc geomar BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 August 25th, 2007 12:39 PM
Simple HTTP POST .Net web service? DaveCollinsPenchant .NET Web Services 1 September 10th, 2004 04:46 PM
How to add hyperlink in crystal report when openin Diamond_in_the_sky Crystal Reports 0 March 24th, 2004 01:25 PM
HTTP Status 405 - HTTP method GET .... nsakic Servlets 1 January 25th, 2004 04:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.