|
-
Dec 11th, 2006, 02:09 AM
#1
Thread Starter
New Member
NavigateURL
I am trying to access URLs from a database using the following code:
Code:
<asp:HyperLink id=HyperLink1 runat="server" ImageUrl='<%# "Images\Maps\" & DataBinder.Eval(Container, "DataItem.ImageURL") %>' NavigateURL='<%# DataBinder.Eval(Container.DataItem, "GoogleMap")%>'>
But what's happening now is that when I run the page, I do see the hyperlink working on the picture but the url starts with something like http://localhost...and then it has the actual url starting with #. Both urls are combined. Anyone know how I can fix this?
This is the link I see:
Code:
http://localhost/Dorknozzle/headquarters.aspx#http://www.google.ca/maps?f=q&hl=en&q=1290+Avenue+of+the+Americas,+new+york&ie=UTF8&z=15&om=#
Last edited by CyCLoBoT; Dec 11th, 2006 at 02:40 AM.
-
Dec 11th, 2006, 04:25 PM
#2
Re: NavigateURL
Instead of using the DataBinder.Eval and also giving the ImageUrl a single quote, do it from the codebehind where you can concatenate in peace.
-
Dec 11th, 2006, 04:27 PM
#3
Thread Starter
New Member
Re: NavigateURL
I don't know what you mean mendhak...I'm very new to this stuff so if you could explain it a bit in detail, I would really appreciate it.
-
Dec 11th, 2006, 05:30 PM
#4
Re: NavigateURL
Assuming you are using a dataset, in your codebehind, write this:
VB Code:
Me.HyperLink1.ImageUrl = "Images/Maps/" & ds.Tables(0).Rows(0).Item("ImageURL").ToString()
Me.HyperLink1.NavigateURL = ds.Tables(0).Rows(0).Item("GoogleMap").ToString()
And let the hyperlink in the design view simply be:
<asp:HyperLink id=HyperLink1 runat="server" >
Modify as appropriate.
-
Dec 11th, 2006, 05:30 PM
#5
Re: NavigateURL
 Originally Posted by CyCLoBoT
you mean mendhak
-
Dec 11th, 2006, 05:54 PM
#6
Thread Starter
New Member
Re: NavigateURL
On my aspx page, I have a oledbdataadapter1, dataset51, oledbconnection1. Now I am just confused about the "codebehind". Does that just mean I have to put the code in the aspx.vb file? But when I try adding there, I get error message that HyperLink1 is not a member of that page. What am I doing wrong here?
Last edited by CyCLoBoT; Dec 11th, 2006 at 05:59 PM.
-
Dec 12th, 2006, 04:56 AM
#7
Re: NavigateURL
I may have to look at your code, but fix this first:
<asp:HyperLink id=HyperLink1
should be
<asp:HyperLink id="HyperLink1"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|