PDA

Click to See Complete Forum and Search --> : resize data grid columns?


kleinma
Jan 20th, 2005, 11:17 AM
I populate a datagrid on my asp.net page using a datatable and datarow to fill a datatable.. then i bind the datatable to my datagrid. it works fine except i can't find any properties that allow for column resizing to a specific size...

anyone know if I can do this?

Patch21
Jan 20th, 2005, 03:32 PM
If you are talking about letting the user resize the columns on the fly by just dragging them, much like the windows datagrid, I do not think that is possible. If anyone knows if you can do this then reply!

You can set the column widths in the code though. You can do this in the ItemDataBound event of the grid:

With dgrDatagrid
.Columns(0).ItemStyle.Width = New Unit(80)
.Columns(1).ItemStyle.Width = New Unit(180)
.Columns(2).ItemStyle.Width = New Unit(120)
.Columns(3).ItemStyle.Width = New Unit(70)
.Columns(4).ItemStyle.Width = New Unit(220)
.Columns(5).ItemStyle.Width = New Unit(70)
.Columns(6).ItemStyle.Width = New Unit(120)
End With

kleinma
Jan 20th, 2005, 04:09 PM
I ended up creating HTML tables in code manually... it is more work for me.. but it provides me with unlimited flexablity versus using a datagrid... the datagrid is cool and all, but I wanted to use some dynamics it just doesn't provide...