How do I hide a column only on the list page in AS

2020-07-27 02:48发布

This is somewhat similar to this question.

However, rather than wanting to hide a column all together, I am just looking to hide the column on the List.aspx page.

My specific example is that fields that are long (or at least nvarchar(MAX)) automatically hide from the List.aspx page as is but are still visible on the Edit.aspx page.

I would like to replicate this behaviour for other (shorter) columns.

Is this possible?

3条回答
成全新的幸福
2楼-- · 2020-07-27 03:26

You can create a custom page for the particular table you want to change. There's an example here.

Within your custom page, you can then set AutoGenerateColumns="false" within the asp:GridView control, and then define exactly the columns you want, like this:

<Columns>
    ...
    <asp:DynamicField DataField="Product" HeaderText="Product" />
    <asp:DynamicField DataField="Colour" HeaderText="Colour" />
</Columns>
查看更多
够拽才男人
3楼-- · 2020-07-27 03:26

I think this solution is a really useful one, because it allow you to use the attribute model to specify which columns go where: http://csharpbits.notaclue.net/2008/10/dynamic-data-hiding-columns-in-selected.html

查看更多
萌系小妹纸
4楼-- · 2020-07-27 03:33

if u r using bootstrap u can set like this

<asp:DynamicField DataField="Id" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden"/>
查看更多
登录 后发表回答