views:

740

answers:

2

Hi,

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  A: 

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>
Mark Pattison
Seems the best/only way :-)I was kind of hoping I could do this generically rather than make a special exception case but I guess I'd have to write my own list page implementation or something. Anyway cool :-)
Graphain
A: 

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

Irwin