Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4321038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:41:57+00:00 2026-05-21T08:41:57+00:00

I have this link of code where I populate a hyperlink with an address

  • 0

I have this link of code where I populate a hyperlink with an address at runtime from the database.

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

The problem is that it’s treating the link as relative. so if the link is yahoo.com, it’ll go to

http://localhost/yahoo.com

or something to that effect.

If my link source is http://www.yahoo.com, that will work, but I cannot guarantee that the links may or may not have the http:// at the start.

How can I get it to always treat it as an absolute URL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:41:58+00:00Added an answer on May 21, 2026 at 8:41 am

    You can try something like this

    NavigateUrl='<%# GetUrl(Eval("Source")) %>'>
    

    with

    public string GetUrl(object source)
    {
        if(source != null)
        {
            string str = source.ToString();
            return str.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase) ?
                               str : 
                               string.Format("http://{0}",str);
        }  
        return string.Empty;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have borrowed code from this link PHP regex templating - find all occurrences
I have this code in the end of link button click: Response.ContentType = application/zip;
i have this code: $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() {
I have this PHP code echo '<a href=# onclick=updateByQuery(\'Layer3\', ' . json_encode($query) . ');>Link
i have a problem using the Catch Clipboard Events code found on this link
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
I have this link: <a href=data:application/pdf;base64,JVBERi0x...KJSVFT0YK>PDF</a> In Safari on MacOsX, clicking the link instantly
I have this href link with text either attivo or non attivo User can
I have seen this link: Implementing Mutual Exclusion in JavaScript . On the other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.