Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#Eval if statement in repeater

Tags:

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 display the link.

 <%if( %> <%#Eval("myURL").ToString().Length > 0 %>        <a  title="myTitle" target="_blank" href="<%# Eval("myURL") %>">my link</a>                    <% } %> 

Can anyone please help?

like image 706
Wildcat Avatar asked Feb 15 '12 08:02

Wildcat


1 Answers

try this code !!!

<%#Eval("myURL").ToString().Length > 0 ? "<a  title='myTitle' target='_blank' href='<%# Eval("myURL") %>'>my link</a>":""%> 
like image 122
Madhu Beela Avatar answered Oct 25 '22 07:10

Madhu Beela