• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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


0
AlexPonnath
Asked:
AlexPonnath
2 Solutions
 
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
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now