I have 2 questions
1) We are using a grid where users can pick the columns that display. As a result the grid width can get very wide and break out of the page. See http://www.creditbootcamp.com/grid_problem.png
Is there a way we can have a horizontal scroll bar automatically appear if it breaks the container? The layout is liquid and uses percentages so we cannot assign any fixed width values. The grid is in a table <TD></TD> which is set at 75% width.
Here is the top grid code (excluding the GridTemplateColumns):
| <ds:DisputeGrid ID="CustomerSearchResults" EnableAjaxSkinRendering="True" EnableRowHover="True" runat="server" Skin='<%#Me.TelerikSkin %>' OnNeedDataSource="CustomerSearchResults_NeedDataSource" AllowSorting="true" EnableViewState="true" AllowCustomPaging="true" OnItemDataBound="CustomerSearchResults_ItemDataBound" OnInit="CustomerSearchResults_Init"> |
What I would like is for a horizontal scroll bar to automatically appear if it breaks the container.
2) My second question is how do you prevent wrapping of items in the grid. When the grid has lots of columns it causes the icons to wrap.
See http://www.creditbootcamp.com/grid_tools.png
We tried:
<rad:GridTemplateColumn UniqueName="Tools" HeaderText="Tools" ItemStyle-Width="150">
But it did not work. Putting the icons in a table did work but caused borders to show up around the table (which we dont want).
Thanks guys!!

| <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" |
| AutoGenerateColumns="False" AllowFilteringByColumn="True" |
| ShowStatusBar="True" OnUpdateCommand="RadGrid1_UpdateCommand" |
| OnInsertCommand="RadGrid1_InsertCommand" |
| OnDeleteCommand="RadGrid1_DeleteCommand" |
| OnNeedDataSource="RadGrid1_NeedDataSource" |
| OnItemDataBound="RadGrid1_ItemDataBound" |
| ShowFooter="True" Skin="Vista" onitemcommand="RadGrid1_ItemCommand"> |
| <MasterTableView DataKeyNames="MuhFisDetayId" AllowMultiColumnSorting="True" |
| CommandItemDisplay="Top" EditMode="InPlace" InsertItemDisplay="Top"> |
| <Columns> |
| <telerik:GridDropDownColumn DataField="HesapId" DataSourceID="LLBLGenProDataSource3" |
| HeaderText="HesapKodu" ListTextField="HesapKodu" ListValueField="HesapId" UniqueName="HesapId"> |
| <ItemStyle HorizontalAlign="Left" Width="160px" /> |
| </telerik:GridDropDownColumn> |
| <telerik:GridTemplateColumn HeaderText="Açıklama" UniqueName="TemplateColumnAciklama" EditFormColumnIndex="1"> |
| <ItemTemplate> |
| <%# Eval("Aciklama")%> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadTextBox runat="server" ID="tbAciklama" DataType="Decimal" |
| Text='<%# Bind("Aciklama") %>' Width="180px"> |
| </telerik:RadTextBox> |
| </EditItemTemplate> |
| <FooterTemplate> |
| <asp:Label runat="server" ID="lblFooterAciklama" Text=" Toplam Borç - Alacak " Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> |
| </FooterTemplate> |
| <ItemStyle HorizontalAlign="Left" Width="200" Wrap="true"/> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Borç" UniqueName="TemplateColumnBorc" EditFormColumnIndex="1"> |
| <ItemTemplate> |
| <%# Eval("Borc" )%> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadNumericTextBox runat="server" ID="tbBorc" Width="40px" DbValue='<%# Bind("Borc") %>' DataType="Decimal"> |
| <ClientEvents OnKeyPress="onKeyPresstbBorc" /> |
| </telerik:RadNumericTextBox> |
| </EditItemTemplate> |
| <FooterTemplate> |
| <asp:Label runat="server" ID="lblBorcToplam" Text="" Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> |
| </FooterTemplate> |
| <ItemStyle HorizontalAlign="Left" Width="120px" /> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Alacak" UniqueName="TemplateColumnAlacak" |
| EditFormColumnIndex="2"> |
| <ItemTemplate> |
| <%# Eval("Alacak")%> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadNumericTextBox runat="server" ID="tbAlacak" Width="40px" DbValue='<%# Bind("Alacak") %>' DataType="Decimal"> |
| <ClientEvents OnKeyPress="onKeyPresstbAlacak" /> |
| </telerik:RadNumericTextBox> |
| </EditItemTemplate> |
| <FooterTemplate> |
| <asp:Label runat="server" ID="lblAlacakToplam" Text="" Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> |
| </FooterTemplate> |
| <ItemStyle HorizontalAlign="Left" Width="120px" /> |
| </telerik:GridTemplateColumn> |
| <telerik:GridEditCommandColumn UpdateText="Kaydet" UniqueName="EditCommandColumn" |
| CancelText="İptal" EditText="Güncelle"> |
| <ItemStyle HorizontalAlign="Center" Width="100" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Sil" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Bu Kaydı Silmek İstediğinizden Eminmisiniz" ItemStyle-Width="50" ItemStyle-HorizontalAlign="Center" /> |
| </Columns> |
| <EditFormSettings CaptionFormatString="{0} nolu Fişi Güncelleme" CaptionDataField="MuhFisDetayId"> |
| <EditColumn ButtonType="ImageButton" /> |
| <FormStyle BackColor="#eef2ea" Width="100%" /> |
| <FormTableStyle CellPadding="2" CellSpacing="0" GridLines="None" /> |
| <FormTableItemStyle Height="29px" Width="100%" /> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnRowCreated="onRowCreated" OnRowCreating="onRowCreating" OnRowDblClick="RowDblClick" OnCommand="onCommand" /> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| var currentRowIndex = null; |
| function onCommand(sender, args) |
| { |
| if(args.get_commandName()== 'Edit') |
| { |
| currentRowIndex = args.get_commandArgument(); |
| } |
| } |
| function onKeyPresstbBorc(sender, eventArgs) |
| { |
| var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView(); |
| var dataItem = masterTable.get_dataItems()[currentRowIndex]; |
| var radTextBox1 = dataItem.findControl("tbAlacak"); |
| radTextBox1.set_value(0.00); |
| } function onKeyPresstbAlacak(sender, eventArgs) { var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView(); var dataItem = masterTable.get_dataItems()[currentRowIndex]; var radTextBox1 = dataItem.findControl("tbBorc"); radTextBox1.set_value(0.00); } |
<
telerik:RadGrid ID="radCategory" runat="server" DataSourceID="dsCategory"
Skin="Vista" GridLines="None" Width="700px" Height="500px"
AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True">
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="False" DataSourceID="dsCategory" EditMode="InPlace"
CommandItemDisplay ="Top" AllowAutomaticUpdates="true" DataKeyNames="CategoryId"
AllowAutomaticInserts="true" AllowAutomaticDeletes="true">
<CommandItemTemplate>
<div style="padding:10px 0px;">Course Category
<asp:LinkButton ID="lnkAddNew" runat="server" CommandName="InitInsert" Visible="True">
<img style="border:0px;vertical-align:middle;" alt="" src="../Images/add.gif" /> Add new Category</asp:LinkButton>
<asp:LinkButton ID="lnkExportExcel" runat="server" CommandName="ExporttoExcel" >
<img style="border:0px;vertical-align:middle;" alt="" src="../Images/Excel.gif" /> Export To Excel </asp:LinkButton>
<asp:LinkButton ID="lnkExportWord" runat="server" CommandName="ExporttoWord" >
<img style="border:0px;vertical-align:middle;" alt="" src="../Images/Word.gif" /> Export To Word </asp:LinkButton>
<asp:LinkButton ID="lnkRefresh" runat="server" CommandName="RebindGrid">
<img style="border:0px;vertical-align:middle;" alt="" src="../Images/Refresh.gif" /> Refresh</asp:LinkButton>
</div>
</CommandItemTemplate>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="CategoryId" DataType="System.Guid"
EmptyDataText="&nbsp;" HeaderText="CategoryId" SortExpression="CategoryId"
UniqueName="CategoryId" ReadOnly="true" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Name" EmptyDataText="&nbsp;"
HeaderText="Name" SortExpression="Name" UniqueName="Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Description" EmptyDataText="&nbsp;"
HeaderText="Description" SortExpression="Description" UniqueName="Description" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton"
CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
<HeaderStyle Width="20px" />
<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
</telerik:GridButtonColumn>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" >
<ItemStyle CssClass="MyImageButton" />
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>