This is a migrated thread and some comments may be shown as answers.

scrollbar

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rtk
Top achievements
Rank 1
rtk asked on 16 Dec 2008, 02:12 PM
My scollbar appears after the grid is loaded. I add my columns on code behind. When the page is loaded, the grid first display in full size, then it's rezised to 150px height with scollbar. Do anyone now how i can fix this?

Here is my code:

<telerik:RadGrid ID="gridLog" Skin="Outlook" EnableEmbeddedSkins="false" Height="150px" AllowSorting="true" AutoGenerateColumns="false" ImagesPath="Css\Grid" runat="server">                       
                        <ClientSettings>
                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                        </ClientSettings>                        
</telerik:RadGrid>

Private Sub BuildLogGrid()
        Dim oDataCol As GridBoundColumn

        oDataCol = New GridBoundColumn
        gridLog.Columns.Add(oDataCol)
        oDataCol.DataField = "logId"
        oDataCol.HeaderText = "Tidspunkt"

oDataCol = New GridBoundColumn
        gridLog.Columns.Add(oDataCol)
        oDataCol.DataField = "logName"
        oDataCol.HeaderText = "Name"
        oDataCol.HeaderStyle.Width = "750"
        oDataCol.ItemStyle.Width = "750"     

        'set the keys for the datagrid
        Dim keys() As String = {"logId"}
        gridLog.MasterTableView.ClientDataKeyNames = keys
        gridLog.MasterTableView.NoMasterRecordsText = ""
    End Sub

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Dec 2008, 02:31 PM
Hi brajoh,

When using scrolling with static headers, RadGrid needs to make some calculations and size adjustments on the client. If you want to prevent this, please use ScrollHeight instead of Height:


<telerik:RadGrid ID="gridLog" runat="server">                       
                        <ClientSettings>
                            <Scrolling AllowScroll="true" UseStaticHeaders="true"
ScrollHeight="150px" />
                        </ClientSettings>                        
</telerik:RadGrid>



Please note that Height is a property, which defines the height of the whole RadGrid control, while the ScrollHeight property defines the height of the control's scrollable area only. This means that the ScrollHeight value should be smaller than the current Height value. Please adjust it according to your preference.

It makes no sense to use the two properties at the same time.


Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
rtk
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or