Hi.
I have a RadGrid (Q3 2009) that i add columns to dynamically at runtime.
My problem is that the total grid width is always 100% of the parent container and the columns are sized thereafter.
I would like the columns to have a size that has an "auto fit" to the content but when the column headers that in my case sometimes are quite long i would like to wrap them as well. But when I set the <HeaderStyle Wrap="true" /> the columns sometimes gets wrapped so that every single word is on a single line which looks really bad (See attachment: croppercapture[1].png)
I would like to have a solution that provides MinWidth and MaxWidth type of values.
I have tried MasterTableView.TableLayout Fixed and Auto but without a decent result. Soo how can I make the grid to size its columns based on the content but still have wrapping but with more control. Can I do it in code behind, and perhaps use some kind of MeasureString() function to set the column size?
Any ideas how to solve my problem?
Thanks in advance.
//Johan
This is the markup.
I have a RadGrid (Q3 2009) that i add columns to dynamically at runtime.
My problem is that the total grid width is always 100% of the parent container and the columns are sized thereafter.
I would like the columns to have a size that has an "auto fit" to the content but when the column headers that in my case sometimes are quite long i would like to wrap them as well. But when I set the <HeaderStyle Wrap="true" /> the columns sometimes gets wrapped so that every single word is on a single line which looks really bad (See attachment: croppercapture[1].png)
I would like to have a solution that provides MinWidth and MaxWidth type of values.
I have tried MasterTableView.TableLayout Fixed and Auto but without a decent result. Soo how can I make the grid to size its columns based on the content but still have wrapping but with more control. Can I do it in code behind, and perhaps use some kind of MeasureString() function to set the column size?
Any ideas how to solve my problem?
Thanks in advance.
//Johan
This is the markup.
<telerik:RadGrid ID="RadGrid1" runat="server" OnColumnCreated="RadGrid1_ColumnCreated" AutoGenerateColumns="false" OnDataBound="RadGrid_DataBound" OnItemDataBound="RadGrid_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource" |
OnSortCommand="RadGrid_SortCommand" AllowSorting="True" BorderWidth="0px" CellPadding="0" AllowMultiRowSelection="True" Skin="Default" meta:resourcekey="RadGrid1Resource1" EnableViewState="False"> |
<ItemStyle Height="10px" /> |
<AlternatingItemStyle Height="10px" BackColor="#F8F9BC" /> |
<MasterTableView EnableViewState="False" AutoGenerateColumns="false"> |
<RowIndicatorColumn Visible="False" /> |
<ExpandCollapseColumn Visible="False" /> |
</MasterTableView> |
<HeaderStyle Font-Bold="True" Font-Size="X-Small" Wrap="True" Height="20px" /> |
<ClientSettings> |
<Selecting AllowRowSelect="True" /> |
<Scrolling AllowScroll="True" UseStaticHeaders="true" /> |
</ClientSettings> |
</telerik:RadGrid> |