PositiveGuy
PositiveGuy

Reputation: 47753

How to escape string in .aspx

I'm trying to get this string to work, I can't escape it correctly or I'm using the wrong syntax " vs '

<a href="<%#string.Format("{0}?ItemRemove=true&iID={1}", Page, <%#Container.DataItem.Id )%>">...</a>

Upvotes: 1

Views: 1735

Answers (2)

Justin Niessner
Justin Niessner

Reputation: 245429

<a href='<%# String.Format("{0}?ItemRemove=true&ID={1}", 
    Page, 
    Container.DataItem.Id) %>'>
...
</a>

...everything is wrapped for read-ability. It can all live on one line, of course.

Upvotes: 2

Lawrence P. Kelley
Lawrence P. Kelley

Reputation: 4326

Try using the apostrophe around the href.

<a href='<%= String.Format("{0}?ItemRemove=true&ID={1}", Page, Container.DataItem.Id) %>'>
...
</a>

Upvotes: 0

Related Questions