Set datagrid column width
How do I set a column width of a datagrid programmatically? Here is part of my code how I add a column to my datagrid.
I have set the width = 10px of the datagrid1 in the Design view, but the datagrid change its size if there are too much data in one record. I want a fixed size datagrid and always stay at the size that I have specified all the time no matter how much data are in a row.
' -- add bound columns to datagrid
Dim col As New BoundColumn
col = New BoundColumn
col.HeaderText = "Name"
col.DataField = Name
col.SortExpression = Name
You can create a table with fix size (using html tag), after that you put your datagrid in to it. Think it will work as u think
I think you have removed the tick on the "wrap content..." indicator in design time. Try to tick it and see whether it could solve the problem.
I will try your both suggestions in the future. At the mean time, I have remove unneccessary fields to keep the datagrid looks good....
Last Post: 04-14-2006, 09:09 AM
By Phil Weber in forum ASP.NET
Last Post: 03-21-2002, 02:47 PM
Last Post: 11-27-2001, 06:53 AM
By YC Choo in forum Database
Last Post: 09-03-2001, 01:42 PM
By Asfar in forum VB Classic
Last Post: 04-25-2001, 01:08 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center