create query string in anchor tag

11,728

Solution 1

<a class="jt" href='WorkExp.aspx?Emplid=<%= Request.QueryString["Emplid"] %>'>Previous Work Experience</a>

Solution 2

EDIT: After a quick test, you could just remove the rel part of the element and set the href as I suggested before:

<a class="jt" href='WorkExp.aspx?Emplid=<%= Request.QueryString["Emplid"] %>'>Previous Work Experience</a>

If the # still appears at the end, all I can think of is that you are appending this to QueryString somewhere else.

Share:
11,728
user728148
Author by

user728148

Updated on June 04, 2022

Comments

  • user728148
    user728148 almost 2 years

    I have an anchor tag in my .aspx page. I want to add a query string to pass the employee ID of the page. I am able to pass the value but it appends a # after the value. Is there a way to remove the # or another way to pass the value?

    My code:

     <a class="jt" href="#" rel='WorkExp.aspx?Emplid=<%# Request.QueryString["Emplid"] %>'>
             Previous Work Experience</a></th>                         
    

    When the page is run, I receive WorkExp.aspx?emplid=111111#

    I want to remove the # after the employee id.

    Thanks,

  • user728148
    user728148 over 12 years
    Thanks Kev. It didn't work. When I add the href value, it doesn't append the emplid.
  • user728148
    user728148 over 12 years
    Thanks Jason. I used this example, in my 'rel' attribute in the anchor tag. I removed the # after <%.
  • user728148
    user728148 over 12 years
    Thanks Kev. I did this and it worked: Removed the # after <%. <a class="jt" href='WorkExp.aspx?Emplid=<%= Request.QueryString["Emplid"] %>' rel='WorkExp.aspx?Emplid=<%= Request.QueryString["Emplid"] %>'>Previous Work Experience</a>
  • Kev Ritchie
    Kev Ritchie over 12 years
    No problem, if you found Jasons answer useful please upvote it :)