Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get grid's column widths
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00962477
Message ID:
00962671
Vues:
8
Kevin,

Thanks for your reply. I guess I am a little confused now :)
Here is what I did. I added a datagrid to my form, then I set the datagrid's DataSource to dataTable1, then added a binding manager to the grid. Then when I run my app the rows in dataTable1 will show up in my grid. At this point I do not have any TableStyles or any GridColumnStyles in my TableStyles. If I add a TableStyle and add some GridColumnStyles and then set the width to different values I can show those widths in a messagebox using the code from your article, but the column widths are not what I see in the grid at run-time and if I change the column widths at run-time the column widths in my messageboxes does not change.

Please let me know if any of this makes sense or if it doesn't. Do I somehow have to link the tablestyle to the view of the grid or something?

Einar


>Hi, Einar,
>
>If you haven't added a tablestyle, then you'll have to do something different.
>
>The grid class from my article grid project automatically creates one, based on the column definitions you supply it.
>
>If you're not explicitly using that class, if you're using your own, you'd have to do something like...
>
>
>DataGridTableStyle style = new DataGridTableStyle();
>style.MappingName = "MyDataTableName";
>
>DataGridTextBoxColumn fld1 = new DataGridTextBoxColumn();
>fld1.HeaderText = "Job #";
>fld1.MappingName = "JobNumber";
>fld1.Width = 55;
>
>DataGridTextBoxColumn fld2 = new DataGridTextBoxColumn();
>fld2.HeaderText = "Job Description";
>fld2.MappingName = "Descript";
>fld2.Width = 115;
>
>style.GridColumnStyles.AddRange(new DataGridColumnStyle[] {fld1, fld2 });
>
>myGrid.TableStyles.Clear();
>myGrid.TableStyles.Add(style);
>
>
>Then you'll have a tablestyle.
>
>Kevin
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform