how show only specific columns gridview dynamic data keeping view-related-table links

Posted by Xpincho under ASP.NET on 5/19/2011 | Points: 10 | Views : 4206 | Status : [Member] | Replies : 2
Hi all:
I am working on a Dynamic Data project using scaffolding on VS2010, and it works very nice when using all fields of a table, it shows every table with all fields, Edit, Insert, view-related-items, etc. But i have some tables with too many fields, i would like to restrict or limit the number of columns to display on some tables, but keeping the auto-generated view-related-tables hyperlinks, so I tried with the Custom pages, disabling AutoGenerateColumns on the GridView and specifying the fields I'd like, creating ItemTemplates, DynamicField, and worked fine, showing the columns specified, but then missed the autogenerated columns, specifically those "View Related-Table-Items", stopped to show themselves...
How to show the view-related-tables hyperlink again along my "selected" columns
Thanks in advance
Pinchete




Responses

Posted by: Ndebata on: 5/20/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
You could try this way, Try to keep AutogenerateColumns="true", with addtion to your custom columns, Then OnPage Load, hide the unwanted columns programmatically
http://www.dotnetfunda.com/codes/code1518-hide-a-column-in-aspnet-gridview-from-code-behind-file.aspx
Thanks,
Debata

Xpincho, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Xpincho on: 5/20/2011 [Member] Starter | Points: 25

Up
0
Down
Debata, thanks for answering, but the Collection of columns obtained with scaffolding within the Metadata table is readonly, could not Remove any column, nor set Visible property


Xpincho, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response