J
JL
Hi all,
I have a DataGrid that is binded from a dataset where the number of columns
is unknown. Therefore I have not set up the columns at design time, but I
would like to control the width of each column.
I have wrote the following code:
Protected WithEvents MyGrid As System.Web.UI.WebControls.DataGrid
Dim GridColumn As System.web.UI.WebControls.TemplateColumn
For Each GridColumn In MyGrid.Columns
GridColumn.HeaderStyle.Width = Unit.Pixel(300)
GridColumn.ItemStyle.Width = Unit.Pixel(300)
Next
....but it does not seem to work. All columns have different widths,
depending on the width of the string inside it.
What is wrong here? Thank you!
I have a DataGrid that is binded from a dataset where the number of columns
is unknown. Therefore I have not set up the columns at design time, but I
would like to control the width of each column.
I have wrote the following code:
Protected WithEvents MyGrid As System.Web.UI.WebControls.DataGrid
Dim GridColumn As System.web.UI.WebControls.TemplateColumn
For Each GridColumn In MyGrid.Columns
GridColumn.HeaderStyle.Width = Unit.Pixel(300)
GridColumn.ItemStyle.Width = Unit.Pixel(300)
Next
....but it does not seem to work. All columns have different widths,
depending on the width of the string inside it.
What is wrong here? Thank you!