If / Else Statement in ASP.NET

I am using a repeater Control and would like to evaluate the date to diplay an image based on the
value of an field. But since this i guess has to happen in the actual ASP page not the code behind
i am having problems...
Below is my stab at it

If  <%# DataBinder.Eval(Container.DataItem, "direction")%> = "inbound" then
<img src="images/image3.gif" />
Else
<img src="images/level3_group.gif" />
end if


AlexPonnathAsked:
Who is Participating?
 
existenz2Commented:
This should work also:
<% If  DataBinder.Eval(Container.DataItem, "direction") = "inbound" then  %>
<img src="images/image3.gif" />
<%Else %>
<img src="images/level3_group.gif" />
<%end if %>
0
 
Solar_FlareCommented:
you should use an IIF statement

<img src='<%# iif(DataBinder.Eval(Container.DataItem, "direction")= "inbound", "images/image3.gif", "images/level3_group.gif")%>' />

that would create an image and set its source to either image3 or level3_group depending if direction="inbound"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.