Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically define GridView columns
Message
De
07/07/2006 23:50:06
 
 
À
07/07/2006 16:24:55
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01134578
Message ID:
01134640
Vues:
14
Hi, Jerry,

Off the top of my head, I can only think of one thing. You could create a subset datatable with just the columns you want....bind the gridview to the new datatable....and set the gridview "generatecolumns" property to true. It's not a very elegant solution, but it should work.

You can use the new ToTable method in ADO.NET 2.0. For instance, if you had a datatable with 10 columns, and you only want to show 3 of them, you could do something like...
DataTable dtNewTable = dtSourceTable.DefaultView.ToTable(false,"MyColumn1","MyColumn2","MyColumn3");
(The first parm of 'false' is for the option to do the equivalent of a "select distinct")

If I can think of something else, I'll follow up, but that's the only thing that comes to mind.

Kevin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform