Saturday, 15 May 2010

asp.net - How to use conditional Eval inside Repeater control? -



asp.net - How to use conditional Eval inside Repeater control? -

how utilize conditional eval within repeater command in case:

if actions.showdates(eval("datesasperiod").tostring(), eval("datelist").tostring().length) > 0 show this: <a href="details.aspx?actionid=<%# eval("id") %>"><%# eval("artist") %></a> else show this: <%# eval("artist") %>

you have wrap if statements in code tags:

<% if (actions.showdates(eval("datesasperiod").tostring(), eval("datelist").tostring().length) > 0) { %> <a href="details.aspx?actionid=<%# eval("id") %>"><%# eval("artist") %></a> <% } else { %> <%# eval("artist") %> <% } %>

inside repeater, should able utilize this:

<%# (actions.showdates(eval("datesasperiod").tostring(), eval("datelist").tostring()).length > 0) ? "<a href="details.aspx?actionid='" + eval("id") + "'>" + eval("artist") + "</a>" : eval("artist") %>

asp.net

No comments:

Post a Comment