Thursday, March 22, 2012

Trouble with Inline If Syntax on asp Image

I have the following asp image, but I'm a little off on the syntax. Could you help. Thanks

<asp:ImageID="RecipeImage"runat="server"Width="176px"Height="115px"ImageUrl='<% (Eval("RecipeID") !=Null) ? "Pictures/recipes/" + Eval("RecipeID") + ".jpg" : "~/Pictures/recipes/NoPhoto2.jpg" %>'/>

why not populate it from the codebehind? IT would be easier... otherwise, wrap a function around it and use that.


I was going to populate it in codebehind based on the querystring id, but i can't because i'm using a pager template and the querystring id is only the id i want one time.

If I use a function, how can I access the Current Id in the FormView?

0 comments:

Post a Comment