Skip to content

WebDataGrid Column Width

New Discussion
Leona
Leona asked on Oct 27, 2016 11:33 AM

I am using Infragistics 2016 16.1 and Visual Studio 2015. I am populating and binding a WebDataGrid in code. The issue I am having is that the column widths are tiny and the text is wrapping. With the UltraGrid I use to be able to set the column width in code under initialize grid however I can't seem to find the same way with teh new grid. I have tried setting no-wrap in the CSS file but nothing is working. I have looked in the forum and I am not finding the answer. Any suggestions?

Sign In to post a reply

Replies

  • 0
    Michael Peterson
    Michael Peterson answered on Oct 26, 2016 5:13 PM

    Hello,

    Thank you for contacting Infragistics!

    How are you creating your columns? When you create your columns you should be able to set the widths then. You can also set the DefaultColumnWidth to give your columns a minimum width they will always have.

    • 0
      Leona
      Leona answered on Oct 26, 2016 5:17 PM

      Programically I am binding the dataset that creates the columns. The dataset columns can change and I didn't want to hard code the column names so the grid automatically sets the column names. I have tried the default column width however I do have one column that needs a far larger width than all the rest and I didn't want all columns to be that big. 

      • 0
        Michael Peterson
        Michael Peterson answered on Oct 26, 2016 9:21 PM

        Hello,

        Thank you for the update. When you auto generate column they do not get added to the columns collection. Note it is recommended to create your columns manually either in markup or code as it gives you more control over setup of the columns and modification of them after the fact. If you still wish to auto generate columns you can access the column by going through the row, for example:

        WebDataGrid1.Rows[0].Items[0].Column.Width;

        Note with this method you will have to know what index your column is at or if you know the column key you can do the following:

        WebDataGrid1.Rows[0].Items.FindItemByKey("ProductID").Column.Width

      • 0
        Leona
        Leona answered on Oct 27, 2016 11:33 AM

        That works great… From here I believe I can set each column width individually finding the max size of each cell in that column and then setting it to the column width. Thanks… 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Leona
Favorites
0
Replies
4
Created On
Oct 27, 2016
Last Post
9 years, 11 months ago

Suggested Discussions

Created by

Created on

Oct 27, 2016 11:33 AM

Last activity on

Oct 27, 2016 11:33 AM