Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to modify dataGrid Column, Headers, etc.?
Message
 
À
05/07/2002 06:47:31
Czarina Joyce Villanueva
Innovision Systems International
Manila, Philippines
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00675553
Message ID:
00675621
Vues:
9
>Please assist me on how to modify dataGrid's columns, headers, etc. I just can't see in the properties the collections just like the datagrid in WEB Forms.

To modify a Windows Forms DataGrid's columns:

1. Select the DataGrid and go to the Properties Window

2. Select the TableStyles property and click on the ellipses button [...] associated with the property. This launches the DataGridTableStyles Editor dialog. This dialog allows you to create a style for a particular DataTable within a DataSet. Click the "Add" button to create a new DataTable style. (You can actually create different styles for multiple DataTables to which you want to bind your DataGrid at run time).

3. In the Properties sheet on the right side of the DataTableStyle dialog, specify the name of the DataTable within the DataSet to which you are binding. For example, if you have a DataSet that contains a DataTable named "Orders", set this property to "Orders".

4. Next, Select the GridColumnStyles property and click the ellipses button [...] associated with the property--this is what you're looking for. This dialog allows you to add columns to the DataGrid.

5. To add a column, click the "Add" button. Now you change properties such as Header Text, Width, Alignment, and so on. The MappingName property specifies the name of the field in your DataTable to which you want to bind the column. For example, if you want to bind a column to the Orders table's OrderID field, enter "OrderID" in the MappingName property.

After that, add as many columns as you like!

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform