Search code examples
asp.netdynamic-data

How do I hide a column only on the list page in ASP.NET Dynamic Data?


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?


Solution

  • 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>