Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a link that includes a querystring variable.

Status
Not open for further replies.

ninelgorb

Programmer
Mar 7, 2005
111
0
0
US
I would like to create a link in the html that includes a variable for the querystring.

Is this how I would do it?

iUserId is the variable I need to include.
Code:
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
<tr>
<td align="right" width="100%"><font face="Tahoma" size="2"><A href='menu.aspx?UserId=<%=iUserId"%>'>Return 
to Menu</A></font>
</td>
</tr>
</table>

Thanks,
Ninel
 
You can just use a HyperLink control and set the NavigateURL property. e.g.
Code:
HyperLink1.NavigateUrl = "mypage.aspx?ID=" & MyVariable


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Erm...exactly as I have shown you above.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
This is how I wrote it:

Code:
<TD align="left" width="33%">
<asp:HyperLink id="lnkExceptionData" runat="server" Font-Names="Tahoma" Font-Size="X-Small" NavigateUrl='menu.aspx?iUserId=<%Cstr(iUserId)%>'>Exception Data</asp:HyperLink></TD>

It's not working. When I move the mouse over the link I see:

I don't see the actual value of iUserId.

Is my syntax incorrect?
 
u have to do this programatically like ca8msm said(not set it in design view)...

Known is handfull, Unknown is worldfull
 
I'm going to use the link button which fires an event. And inside that I'll just redirect.

Thanks,
Ninel
 
Please help, having same issu

How to change link's href dynamically, say something like this

Code:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container.DataItem,"Value")%>
<br>
<a href=[COLOR=red]'<%#whatToPlaceHere()%>'[/color]>link</a><br>
</li>
</ItemTemplate>
</asp:Repeater>

where
Code:
string whatToPlaceHere()
{
   retur someDropDown.SelectedValue;
}
 
hm, it's working
Code:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container.DataItem,"Value")%>
<br>
<a href=[COLOR=red]"some.aspx?id=<%#whatToPlaceHere()%>"[/color]>link</a><br>
</li>
</ItemTemplate>
</asp:Repeater>

Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top