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 6125677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:16:31+00:00 2026-05-23T16:16:31+00:00

I am using ASP.NET tags in my markup an ASCX file. <a id=MyId runat=server

  • 0

I am using ASP.NET tags in my markup an ASCX file.

<a id="MyId" runat="server" href="page.aspx?id=<%= Item.Id %>">View Item</a>

Item is a property in my control class in code behind.

However, the markup above is being rendered to the HTML unchanged, include the <%= %> characters.

Does anyone have any idea why this might be?

  • 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-23T16:16:32+00:00Added an answer on May 23, 2026 at 4:16 pm

    Try removing the runat="server" attribute from the anchor, like so:

    <a href="<%= string.Format("{0}?id={1}", ResolveUrl("~/page.aspx"), item.Id) %>">
        View Item
    </a>
    

    or use a HyperLink:

    <asp:HyperLink ID="link" runat="server" NavigateUrl="~/page.aspx?id={0}">
        View Item
    </asp:HyperLink>
    

    and in the code behind set the value:

    link.NavigateUrl = string.Format(link.NavigateUrl, item.Id);
    

    or using data binding syntax:

    <asp:HyperLink ID="link" runat="server" NavigateUrl='<%# string.Format("~/page.aspx?id={0}", item.Id) %>'>
        View Item
    </asp:HyperLink>
    

    and in the code behind call:

    Page.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a cost to using server tags in an ASP.NET MVC view? In
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.Net, I have a server control for which i would like to add
Asp.net is my first incursion into web development using server side tech. The last
I am using ASP.NET 2.0 and SQL Server 2005. I am saving a value/string
I have a UserControl which rather than putting tags into its ascx markup file,
I'm using a asp.net slider inside an UpdatePanel within a page control . I
I'm using the ASP.NET 4 MetaKeywords and MetaDescription on every page to set the
With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to
Using ASP.NET, how can I strip the HTML tags from a given string reliably

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.