Does anyone know of a way of hiding a column in an asp.net listview?

前端 未结 7 1906
悲哀的现实
悲哀的现实 2021-01-17 14:45

I know you can put <% if %> statements in the ItemTemplate to hide controls but the column is still there. You cannot put <% %> statements into the LayoutTemplate whic

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-17 15:41

    The ListView gives you full control about how the data is rendered to the client. You specify the Layout Template, and give a placeholder which will be where each item is injected.

    The output of the below will give you a table, and each item will be a new TR.

    Notice the use of runat='server' and visible ='<%# %>'

    
        
            
            
    <%# Eval("SuperCoolIcon") %> <%# Eval("Name") %> <%# Eval("Age") %>

提交回复
热议问题