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?
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.
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.
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
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...