asp:Hyperlink Question

G

Guest

I have the following hyperlink webcontrol. The problem is that I can't
figure out how to pass the webform's Request.Querystring("id") param into the
NavigateURL as shown below. As it is currently formatted the hyperlink
appears but I can't click on it. Could someone please let me know how to
format this correctly?

<asp:HyperLink id="hlBarcodes" style="Z-INDEX: 112; LEFT: 465px; POSITION:
absolute; TOP: 115px" runat="server" Text="Barcodes" NavigateURL='<%#
"Barcodes.aspx?id=" & Request.Querystring("id") %>' Target="_blank"
Name="HyperLink2" Width="72px" ForeColor="White" Font-Names="Verdana"
Font-Size="Larger"></asp:HyperLink>
 
K

Karl Seguin

MrMike, is this hyperlink inside a repeater/datagrid/datalist? I ask
because the <%# is a databinding expression....

if it isn't, you need to use
hlBarCodes.NavigateUrl = "BarCodes.aspx?id=" & Request.QueryString("id")

in the page_load event (either in codebehind or not). If you don't want to
do this, simply use a normal link...

<a href="Barcodes.aspx?id=<%=Request.QueryString("id")%>" target="..."
....>...</a> but that isn't very .net

Karl
 
P

Patrick Olurotimi Ige

Well as Karl explained..u can use either of the 2 it depends how u want
the links rendered

hlBarCodes.NavigateUrl = "BarCodes.aspx?id=" & Request.QueryString("id")

<a href="barcodes.aspx?id=<%=request.querystring("id")%>" target="..."
....>...</a>

Patrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top