?
Solved

ASP.NET <a href create query string param issue

Posted on 2012-09-04
3
Medium Priority
?
801 Views
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:

http://localhost/mypage.aspx?ID=

I need it to display

http://localhost/mypage.aspx?ID=5

Any ideas?
0
Comment
Question by:CipherIS
3 Comments
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 38364303
try this
 <a href='mypage.aspx?ID=<%= GetID() %>'>test</a>

Open in new window

0
 
LVL 1

Author Comment

by:CipherIS
ID: 38364309
@meeran03

When I remove the # it errors.
0
 
LVL 13

Expert Comment

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

807 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