locked
Hyperlink to omit slash or http:// RRS feed

  • Question

  • User380413204 posted

    Hi,

    I have this filed in a table that I want to present as a hyperlink:

    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl = '<%# Bind("Link") %>' Target="_blank" Text='<%# Bind("Link") %>'></asp:HyperLink>

    This in itself works fine, however I need to put in the text preceded by // or http://

    Is it also possible to just start with www?

    Thanks in advance,

    Lex

     

    Tuesday, July 11, 2006 12:25 PM

All replies

  • User-1346905220 posted

    Lex-

    If I understand what you want, then try this:

    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl = '<%# "http://www." + Bind("Link") %>' Target="_blank" Text='<%# Bind("Link") %>'></asp:HyperLink>

    Hope this helps.

    -Mike

    Tuesday, July 11, 2006 8:23 PM
  • User380413204 posted

    Hi,

    No, when I try that I get

    Compiler Error Message: BC30451: Name 'Bind' is not declared.

    Lex

    Wednesday, July 12, 2006 9:06 AM
  • User-1346905220 posted

    Lex-

    Sorry, I didn't get to try it out and I'm afraid I'm getting a little confused in my old age [:)]. Try this instead:

    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl = '<%# Bind("Link","http://www.{0}") %>' Target="_blank" Text='<%# Bind("Link") %>'></asp:HyperLink>

    -Mike

    Wednesday, July 12, 2006 12:54 PM
  • User380413204 posted

    Hi,

    Yep, this one works,

    Tell me about it (always delighted when I found my way home again...)

    Thanks,

    Lex

    Wednesday, July 12, 2006 1:38 PM