Hello, I have a couple of issues with the grid control and column sizing. Here is my scenerio; I have grid inside a div that is set for 100% width. I did look at http://demos.telerik.com/aspnet-ajax/grid/examples/client/scrolling/defaultcs.aspx and near as I can tell I did it all correctly.
Issue 1:
I have two columns that are given a header style width of 100px. When I open the form the two columns are split equally to the width of the window. My expectation is that they are two columns at 100px each with a filler block taking up the rest of the space. I open the form and then manully resize the columns back to 100px this is indeed what I get.
Issue 2:
I have 6 columns at 150px each. Sometimes (not consistently) the grid wil shrink the columns rather than display a horizontal scroll bar. So I end up with 6 columns at 75px each rather than getting a scroll bar.
Issue 3:
Why is it that when I fix the column headers (UseStaticHeaders) There is a white box at the top of the scroll bar rather than a column header. It looks correct if I have UseStaticHeaders turned off.
Here is the page
And the code behind
Issue 1:
I have two columns that are given a header style width of 100px. When I open the form the two columns are split equally to the width of the window. My expectation is that they are two columns at 100px each with a filler block taking up the rest of the space. I open the form and then manully resize the columns back to 100px this is indeed what I get.
Issue 2:
I have 6 columns at 150px each. Sometimes (not consistently) the grid wil shrink the columns rather than display a horizontal scroll bar. So I end up with 6 columns at 75px each rather than getting a scroll bar.
Issue 3:
Why is it that when I fix the column headers (UseStaticHeaders) There is a white box at the top of the scroll bar rather than a column header. It looks correct if I have UseStaticHeaders turned off.
Here is the page
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title></title> |
| <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" /> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| <Scripts> |
| <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> |
| <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> |
| </Scripts> |
| </telerik:RadScriptManager> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| </telerik:RadAjaxManager> |
| <div> |
| <p>Both columns are specified as 100 px, the scroll bars are turn on so why are my columns wider than 100 px?</p> |
| <p>Why is there a little empty white box looking like a nudist at a grand ball sitting at the top of the vertical scroll bar.</p> |
| <telerik:RadGrid ID="Grid" runat="server" |
| Width="100%" Height="200px" |
| AllowFilteringByColumn="false" |
| ShowStatusBar="true" AllowSorting="true" |
| AutoGenerateColumns="false" |
| AllowPaging="True" AllowCustomPaging="True" |
| OnNeedDataSource="GridNeedDataSource" > |
| <PagerStyle Mode="NextPrevAndNumeric"/> |
| <ClientSettings AllowDragToGroup="false" > |
| <Scrolling AllowScroll="true" |
| EnableVirtualScrollPaging="false" |
| SaveScrollPosition="false" |
| UseStaticHeaders="true"/> |
| <Resizing AllowColumnResize="true" |
| AllowRowResize="false" |
| EnableRealTimeResize="false" |
| ResizeGridOnColumnResize="false" |
| ClipCellContentOnResize="true"/> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| <MasterTableView AllowCustomSorting="true" TableLayout="Fixed"> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Col1" DataField="field1"> |
| <HeaderStyle Width="100" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col2" DataField="field2"> |
| <HeaderStyle Width="100" /> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </div> |
| <div> |
| <p>If you open this in a browser window that is less than 900px, rather than a scroll bar I get a smaller columns why?</p> |
| <p>If I fix the grid width to 600 px, I get the scroll bars.</p> |
| <telerik:RadGrid ID="Grid2" runat="server" |
| Width="100%" Height="200px" |
| AllowFilteringByColumn="false" |
| ShowStatusBar="true" AllowSorting="true" |
| AutoGenerateColumns="false" |
| AllowPaging="True" AllowCustomPaging="True" |
| OnNeedDataSource="GridNeedDataSource" > |
| <PagerStyle Mode="NextPrevAndNumeric"/> |
| <ClientSettings AllowDragToGroup="false" > |
| <Scrolling AllowScroll="true" |
| EnableVirtualScrollPaging="false" |
| SaveScrollPosition="false" |
| UseStaticHeaders="true"/> |
| <Resizing AllowColumnResize="true" |
| AllowRowResize="false" |
| EnableRealTimeResize="false" |
| ResizeGridOnColumnResize="false" |
| ClipCellContentOnResize="true"/> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| <MasterTableView AllowCustomSorting="true" TableLayout="Fixed"> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Col1" DataField="field1"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col2" DataField="field2"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col3" DataField="field2"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col4" DataField="field2"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col3" DataField="field2"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Col4" DataField="field2"> |
| <HeaderStyle Width="150" /> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </div> |
| </form> |
| </body> |
| </html> |
And the code behind
| using System; |
| using Telerik.Web.UI; |
| public partial class Default : System.Web.UI.Page |
| { |
| public class Foo |
| { |
| public Foo() |
| { |
| Field1 = Guid.NewGuid().ToString(); |
| Field2 = Guid.NewGuid().ToString(); |
| } |
| public string Field1 { get; set; } |
| public string Field2 { get; set; } |
| } |
| private Foo[] FooArray = new[] |
| { |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| new Foo(), |
| }; |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| } |
| protected void GridNeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| Grid.DataSource = FooArray; |
| Grid2.DataSource = FooArray; |
| } |
| } |
