Author: DevinDow | Posted on: 12/18/2008 10:44:29 AM | Views : 308

QUESTION : How can I conditionally set the "A HREF" depending on an "Eval()"?

More generally, how can I do conditional code in an .ASPX page? (i.e. Can I / how do I use "if" in writing the "HREF" value?)



SIDE QUESTION : What do you call it when you use "Eval()" inside of "<%#   %>"? (If I knew I could probably search the forums better for some ideas.)





MY SPECIFIC EXAMPLE

I have a link in an ItemTemplate of a FormView :


href='<%# "Item.aspx?ID=" + Eval("ItemID") %>'


Sometimes "ItemID" is NULL, and when it is, I don't want it to link to the page "Item.aspx?ID=" (with a blank "ID=").

(In fact, I'd like to remove the link all together if the "ItemID" is NULL.)



Any thoughts or suggestions would be greatly appreciated, incl ...

Go to the complete details ...