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

前端 未结 7 1919
悲哀的现实
悲哀的现实 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:32

    To access the layout template column header text, I made them labels in the template, and did a findcontrol in the prerender of the listview, then made the labels blank text if the column should be "off". This might not work for your intentions, but for me I still wanted the column space to be used, just appear blank.

    The further you go try to make a listview bend over backwards, the more you will wish you used a grid instead.

提交回复
热议问题