I\'m trying to check a string value inside a repeater, and if it has value then write a link, but can\'t seem to get it to work. If there is a value in myUrl then I want to
I would use the String.Format and include the HTML as part of the string. Admittedly, it's not the neatest piece of code ever written, but in my opinion it's the best option:
For example the below will output an anchor tag if the property Url exists, otherwise it will output a span.
<%# string.Format(Eval("Url") != null ? "{1}" : "{1}", Eval("Url"), Eval("Text")) %>">