How do I conditionally control the visibility of a control in ASP.NET?

后端 未结 1 1193
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 05:26

I\'ve got an asp:Image. I want this control to display, only if <%#Eval(\"Image\")%> is not null.

I do not know how to write this con

1条回答
  •  萌比男神i
    2021-01-19 05:48

    You can bind the Visible property of your control to the expression and call DataBind() while the page is loading:

    
    

    If you are not using server controls and want to show/hide simple markup, you can simply enclose it in an if statement:

    <% if ( condition ) { %>
        
    <% } %>
    

    0 讨论(0)
提交回复
热议问题