tags:

views:

39

answers:

1

I know there is some syntax with ? to optionally render attribute. But I can't find it now that I need it ...

Something like:

 < input checked=<%? model.IsActivated % >  ...

Thanks.

EDIT: Since it seems that nobody knows... perhaps it was some different view engine. Thanks for answers any way :)

+1  A: 
 <input checked="<%= model.IsActivated ? "checked" : string.empty % >"...

But the presense of the "checked" attribute might cause it to be checked, I can't remember. But if that's the case then you'll want

<input <%= model.IsActivated ? "checked=\"checked\"" : string.Empty %> ...

EDIT: btw its called the ternary(? or conditional) operator

David Archer
Yes, thats the case AFAIK
majkinetor