Reputation: 4375
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")%>¶m2=<%#Eval("p2")%>'Here</a> to view results"
Upvotes: 1
Views: 1891
Reputation: 3198
Try this:
bodyText += <%# String.Format("Please Click <a href=\"http://urlpath/Default.aspx?param1{0}¶m2={1}\">Here</a> to view results", Eval("p1"), Eval("p2")) %>
Use String.Format()
for clarity and mind double quotes for HTML attributes.
Upvotes: 1
Reputation: 3082
You have to escape the embedded double quote characters:
bodyText = bodyText + "Please Click '<a href=http://urlpath/Default.aspx?param1=<%#Eval(\"p1\")%>¶m2=<%#Eval(\"p2\")%>'Here</a> to view results"
Upvotes: 1
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")%>¶m2=<%#Eval("p2")%>'>Here</a> to view results"
Upvotes: 1