Reputation: 11471
I have a RadGrid but it is spanning the width across the page, how can I control it and set a width and mae contents in the cells wrap if they need to?. I cant find anything that is helping me. I tried MasterTableView-TableLayout="fix" but then anything in the cells gets cut off. Any help would be much appreciated:
<RadGrid:CustomRadGrid ID="DetailsGrid" runat="server" AutoGenerateColumns="False"
ShowFooter="True" OnNeedDataSource="DetailsGrid_NeedDataSource" OnItemDataBound="DetailsGrid_ItemDataBound"
OnItemCreated="DetailsGrid_ItemCreated"
OnItemCommand="DetailsGrid_ItemCommand"
GridLines="None" AllowFilteringByColumn="True"
AllowPaging="True"
AllowSorting="True"
AllowMultiRowSelection="true">
THIS IS A CUSTOM GRID
Upvotes: 3
Views: 16455
Reputation: 4063
For RadGrid width you just need to set width of the grid.
<telerik:RadAjaxPanel ID="RadAjaxPanel" runat="server">
<telerik:RadGrid ID="ViewLogsGrid" FilterType="Combined"
runat="server"
AllowFilteringByColumn="true"
PageSize="50"
ShowStatusBar="true"
AllowPaging="True"
AllowSorting="True"
Width="1250px"
AllowFiltering="True"
AutoGenerateColumns="false"
GridLines="None"
CellSpacing="0">
</telerik:RadGrid>
</telerik:RadAjaxPanel>
Columns inside the grid will adjust as needed but if you need to fix a column width do the following (Telerik doesn't recommend it);
<telerik:RadGrid ID="ViewLogsGrid" ... ... >
<MasterTableView TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" SortExpression="Comments" UniqueName="Comments">
<HeaderStyle Width="150px" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Upvotes: 1
Reputation: 3012
Use the Width
attribute in the main RadGrid
tag. Content in cells will automatically wrap. You may have to set the width on individual columns as well to get the appropriate look. The auto column width doesn't always wrap where you want it to.
Upvotes: 2