Set datagrid column width


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Set datagrid column width

  1. #1
    Join Date
    Feb 2005
    Posts
    91

    Question Set datagrid column width

    Hi people,

    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.

    Code:
            ' -- add bound columns to datagrid
            Dim col As New BoundColumn
    
            col = New BoundColumn
            col.HeaderText = "Name"
            col.DataField = Name
            col.SortExpression = Name
            DataGrid1.Columns.Add(col)
    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.

    Please help

    Kero

  2. #2
    Join Date
    Oct 2005
    Posts
    1
    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

  3. #3
    Join Date
    Aug 2005
    Posts
    111
    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.

  4. #4
    Join Date
    Feb 2005
    Posts
    91
    thanks both,

    I will try your both suggestions in the future. At the mean time, I have remove unneccessary fields to keep the datagrid looks good....

    kero

Similar Threads

  1. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  2. Truncate DataGrid column?
    By Phil Weber in forum ASP.NET
    Replies: 0
    Last Post: 03-21-2002, 02:47 PM
  3. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 06:53 AM
  4. Create Procedure
    By YC Choo in forum Database
    Replies: 5
    Last Post: 09-03-2001, 01:42 PM
  5. How to set a datacombo in a datagrid
    By Asfar in forum VB Classic
    Replies: 1
    Last Post: 04-25-2001, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center