Do not see a setting that sets the columns to stretch to the full width of the grid width automatically. Is there a simple way to do this?
Hi jcom39201,
One way to approach this would be to set the widths of all but your last grid column and set the width of the last column to 100% (this would automatically stretch it to the size of the remaining space).
Another approach which would autosize columns to a suitable state (though not necessarily to the full width of the grid) would be to set the TableLayout property of the grid's DisplayLayout to Auto. Please note that fixed headers and stationary margins have to be disabled in that scenario.
Please tell me if this helps.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Thanks for the reply Petar. I tried the second approach and it did not look like it did anything. The columns looked like they were set to the default setting and only half the grid width was filled.
I am trying to get it to stretch all columns relative to the Grid width so that on different resolution screens it will show appropriately. I tried doing a percentage of the grid.width.value but that shows as 100 (not sure what type of units). I believe because I have it set to 100%, but I don't think it computes width at runtime, but I could be wrong.
If your grid's width is in percents you can assign the widths of your other columns by handling the PreRender event. For instance:
protected void UltraWebGrid1_PreRender(object sender, EventArgs e) { Debug.WriteLine(UltraWebGrid1.Width.Value); int numberOfColumns = UltraWebGrid1.Columns.Count; for (int i = 0; i < numberOfColumns; i++) { UltraWebGrid1.Columns[i].Width = new Unit((UltraWebGrid1.Width.Value/numberOfColumns).ToString() + "%"); } }
This would assign equal widths to your columns (in percentages).
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Hi Dale,
You are welcome. Glad that I was able to answer your question. Please feel free to contact me if you need further assistance.
Petar,
Once again thank you very much for the answer to this. Worked perfectly! I also have some cases where I use multiple bands and I just added in the band().columns for each band and it rendered just as I needed.
Thanks again!
Dale