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

Allow Scrolling Using Javascript

1 Answer 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 06 Jan 2010, 01:32 PM


Initially AllowScroll=False in RadGrid

I have wrote code as below in javascript 
 var grid = $find("<%= RadGrid3.ClientID %>");
then 
grid.ClientSettings.Scrolling.AllowScroll = true;
grid.GridDataDiv.style.height = "150px" 

but GridDataDiv returns null in this case


but when AllowScroll=True  in RadGrid 

then 

grid.GridDataDiv.style.height = "150px"  this line of code works.


Why 
grid.ClientSettings.Scrolling.AllowScroll = true;
is not supporting..
i want to set AllowScroll  using javascript becoz if records are less then no need of scrolling.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Jan 2010, 01:41 PM
Hello John,

The RadGrid control's HTML rendering is quite different when scrolling is enabled and when it is disabled. Switching the two modes on the client is not possible. The grid.ClientSettings.Scrolling.AllowScroll property value is serialized from the server and is not meant to be changed on the client.

What you can do is enable scrolling initially and change the RadGrid height on the client, depending on the number of records.

http://www.telerik.com/help/aspnet-ajax/grdresizegridwithscrollingwhenlessdata.html

or

http://www.telerik.com/community/code-library/aspnet-ajax/grid/how-to-set-radgrid-height-client-side-with-javascript.aspx


All the best,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or