开发者

Use to c# in html to perform if statement

I've previously seen answers on Stackoverflow that involve using 'the c# construct' to essentially perform an 'if' statement in the html of a开发者_StackOverflow社区 asp.net page.

So imagine i want to display Eval("option1") if its not null OR Eval("option2") if option 1 is null. How do i do this???

Hope that makes sense....

Many Thanks!!!!


Is this the "if" semantics you are looking for?

<% if (condition == true) { %>
  Show something
<% } else { %>
  Show something else
<%} %>


You don't need if statement for it. Just use

<%= Eval("option1") ?? Eval("option2") %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜