ASP.NET <a href create query string param issue

Posted on 2012-09-04
Last Modified: 2012-09-04
I am having an issue with my <a href returning a value to dynamically create a query string param.

<a href='mypage.aspx?ID=<%# GetID() %>'>test</a><br />

Open in new window

protected string GetID()
    return ViewState["ID"].ToString();

Open in new window

when I mouse over it shows as:


I need it to display


Any ideas?
Question by:CipherIS
    LVL 18

    Accepted Solution

    try this
     <a href='mypage.aspx?ID=<%= GetID() %>'>test</a>

    Open in new window

    LVL 1

    Author Comment


    When I remove the # it errors.
    LVL 13

    Expert Comment

    by:Jesus Rodriguez
    <a href='mypage.aspx?ID=<%# Eval(GetID()) %>'>test</a><br />

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now