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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigate URL for ASP:Hyperlink to pass two strings

Status
Not open for further replies.

bubberz

Programmer
Dec 23, 2004
117
US
I have the hyperlink below that I can't get the syntax correct (I'm trying to pass the Primary key field, UniqueIdentifier, for the datagrid item, along with a label value, lblSAID):

<asp:HyperLink id="HyperLink1" runat="server" Text="Locate" NavigateUrl='<%# "RL.aspx?id=" & DataBinder.Eval(Container, "DataItem.UniqueIdentifier")" & "SAID="&"lblSAID.Text.ToString" %>'>
</asp:HyperLink>
 
You have an extra set of quotes that either need to be removed or an ampersand in front of them. Take out the ones in blue and change the ones in red:
Code:
<asp:HyperLink id="Hyperlink1" runat="server" Text="Locate" NavigateUrl=[COLOR=red]""[/color]<%# "RL.aspx?id=" & DataBinder.Eval(Container, "DataItem.UniqueIdentifier")[COLOR=blue]"[/color] & "SAID="&[COLOR=blue]"[/color]lblSAID.Text.ToString[COLOR=blue]"[/color] %>[COLOR=red]""[/color]>
</asp:HyperLink>

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Getting:

" The server tag is not well formed. "
NavigateUrl=""<%# "RL.aspx?id=" & DataBinder.Eval(Container, "DataItem.UniqueIdentifier") & "SAID=" & lblSAID.Text.Tostring %>"">
 
Chopstik,
I got the formatting correct, and now see the URL with both values....

I want to pull out the SAID value into a label on the page.

lblSAID.Text = Request.QueryString("SAID") isn't working for the label Load event...nothing shows up

My URL looks like:

I need the lblSAID.TEXT to equal 01.06
 
You may need to server.URLEncode the SAID variable if it is going to have a decimal point in it. Subsequently, if you want to use it later, then simply server.HTMLEncode it.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top