cableload
cableload

Reputation: 4375

Anchor and passing multiple query strings

I am trying to send an email with a link that contains multiple query strings. However i am getting an error that ";" expected near Eval.

bodyText is the body of the email that i am trying to send.

This is what i have tried.

 bodyText = bodyText + "Please Click '<a href=http://urlpath/Default.aspx?param1=<%#Eval("p1")%>&param2=<%#Eval("p2")%>'Here</a> to view results"

Upvotes: 1

Views: 1891

Answers (3)

glautrou
glautrou

Reputation: 3198

Try this:

bodyText += <%# String.Format("Please Click <a href=\"http://urlpath/Default.aspx?param1{0}&param2={1}\">Here</a> to view results", Eval("p1"), Eval("p2")) %>

Use String.Format() for clarity and mind double quotes for HTML attributes.

Upvotes: 1

Keith Payne
Keith Payne

Reputation: 3082

You have to escape the embedded double quote characters:

bodyText = bodyText + "Please Click '<a href=http://urlpath/Default.aspx?param1=<%#Eval(\"p1\")%>&param2=<%#Eval(\"p2\")%>'Here</a> to view results"

Upvotes: 1

COLD TOLD
COLD TOLD

Reputation: 13579

not sure if it the problem but your tag is not formated correctly should be like

bodyText = bodyText + "Please Click '<a href='http://urlpath/Default.aspx?param1=<%#Eval("p1")%>&param2=<%#Eval("p2")%>'>Here</a> to view results"

Upvotes: 1

Related Questions