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

  • Home
  • SEARCH
  • 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 9057659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:31:01+00:00 2026-06-16T14:31:01+00:00

I have the following code behind: protected string VcdControlPanelLink { get; set; } protected

  • 0

I have the following code behind:

protected string VcdControlPanelLink { get; set; }

protected void Page_Load(object sender, EventArgs e) {
    VcdControlPanelLink = "http://www.mywebsite.com";
}

And the following markup:

<a href='<%# Eval(VcdControlPanelLink) %>' target="_blank" title="View the VDC control panel">VDC control panel</a>

But when I run the page, the href tag is rendered as an empty string:

<a title="View the VDC control panel" target="_blank" href="">VDC control panel</a>

I have tried various combinations of markup etc, but cannot get it to work. What am i missing?

  • 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-06-16T14:31:02+00:00Added an answer on June 16, 2026 at 2:31 pm

    If you use data binding expressions <%# ... %> in templates (e.g. the ItemTemplate of a GridView), data binding is invoked automatically. However, if you use such expressions outside of templates, you need to invoke data binding yourself by calling Control.DataBind() (or this.DataBind() in your case):

    protected string VcdControlPanelLink { get; set; }
    
    protected void Page_Load(object sender, EventArgs e) {
        VcdControlPanelLink = "http://www.mywebsite.com";
        this.DataBind();
    }
    
    <!-- Note that you do *not* use Eval here! -->
    <a href='<%# VcdControlPanelLink %>' target="_blank" ... />
    

    However, I don’t think data binding is the right tool here. Since you are using basic HTML elements (instead of web controls), you can just use an inline ASP.NET expression (no this.DataBind() required):

    <a href='<%= VcdControlPanelLink %>' target="_blank" ... />
    

    In any case, make sure your link does not contain quotes ', or you are in for some HTML injection. If the value is supplied by the user, don’t forget to HtmlEncode and sanitize it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a master page with the following code: protected void Page_Init(object sender, EventArgs
I have the following code to check for valid users: protected void Login_LoginError(object sender,
I have the following code behind a button in Visual Studio 2010 private void
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
Consider you have the following code: public abstract class MenuItem { protected string m_Title;
I have following code. ASPX Page <a href=AnyASPXPageOfWebsite.aspx onclick=javascript:CallJQuery(); > Set Price </a> JS
I have the following code in my codebehind Page_Load function that sets the default
ok, i have the following class in my code behind file. it's a very
I have the following code behind: public partial class _Default : System.Web.UI.Page { List<GlassesCollection>
ASP.NET 4.0 Webforms project. I have the following in my code-behind. public partial class

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.