Results 1 to 7 of 7

Thread: NavigateURL

  1. #1
    New Member
    Join Date
    Oct 06
    Posts
    11

    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 01:40 AM.

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    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.

  3. #3
    New Member
    Join Date
    Oct 06
    Posts
    11

    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.

  4. #4
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: NavigateURL

    Assuming you are using a dataset, in your codebehind, write this:

    VB Code:
    1. Me.HyperLink1.ImageUrl = "Images/Maps/" & ds.Tables(0).Rows(0).Item("ImageURL").ToString()
    2. 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.

  5. #5
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: NavigateURL

    Quote Originally Posted by CyCLoBoT
    you mean mendhak

  6. #6
    New Member
    Join Date
    Oct 06
    Posts
    11

    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 04:59 PM.

  7. #7
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    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
  •