Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Controls and Business Objects
Message
De
10/06/2004 15:23:18
 
 
À
10/06/2004 15:11:24
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Divers
Thread ID:
00912387
Message ID:
00912394
Vues:
20
Michael,

Jeez...and I thought I was the wordiest guy on the planet!

I may be mis-reading your question, and if I have, I apologize, but here's a very simple code sample for customizing the display of a grid for specific # of columns.

This is based on a datatable, so I don't know if it applies to what you're doing, but here it is...

dataGridEmployees.DataSource = DsEmployeeHeaders.Tables[0];

DataGridTableStyle style = new DataGridTableStyle();
style.MappingName = "EmployeeResults";

DataGridTextBoxColumn fld1 = new DataGridTextBoxColumn();
fld1.Alignment = HorizontalAlignment.Left;
fld1.HeaderText = "First Name";
fld1.MappingName = "FirstName";
fld1.ReadOnly = true;
fld1.Width = 85;

DataGridTextBoxColumn fld2 = new DataGridTextBoxColumn();
fld2.Alignment = HorizontalAlignment.Left;
fld2.HeaderText = "Last Name";
fld2.MappingName = "lastname";
fld2.ReadOnly = true;
fld2.Width = 85;

DataGridTextBoxColumn fld3 = new DataGridTextBoxColumn();
fld3.Alignment = HorizontalAlignment.Left;
fld3.HeaderText = "Address";
fld3.MappingName = "Address1";
fld3.ReadOnly = true;
fld3.Width = 180;

style.GridColumnStyles.AddRange(new DataGridColumnStyle[] {fld1, fld2, fld3});
style.PreferredRowHeight = 20;
style.BackColor = Color.FromArgb(255,255,255);
style.AlternatingBackColor = Color.FromArgb(234,239,251);
style.SelectionBackColor = Color.FromArgb(118, 149, 222);
dataGridEmployees.TableStyles.Clear();
dataGridEmployees.TableStyles.Add(style);

dataGridEmployees.DataSource = DsEmployeeHeaders.Tables[0];
DsEmployeeHeaders.Tables[0].DefaultView.AllowNew = false;

Does that help?

Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform