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

How to get the scrollheight in the gridview?

3 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suneco
Top achievements
Rank 2
Suneco asked on 11 Nov 2010, 10:35 AM
Greetings!

I was curious about how to get the scrollheight in a gridview. Because if i click a row in the gridview when the gridview is scrolled down, my context menu appear almost at the bottem of the page. But if the grid isn`t scrolled, the context menu appears as it should be. So i`m searching for a way to maintain the contextmenu within the gridview. I think the scrollheight can help me with that.

If you know a solution for this, please reply! ( or a solution without the scrollheight).

Thanks in forward!

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 11 Nov 2010, 01:44 PM
Hi Jeroen,

The ScrollHeight of RadGrid can be retrieved client-side with this Javascript expression:

var scrollHeight = gridObject.GridDataDiv.scrollHeight;

You may also need:

var scrollTopOffset = gridObject.GridDataDiv.scrollTop;

I am not really sure what the problem is in your scenario. Here is a demo, which works as expected if you enable RadGrid scrolling. You can compare with your implementation:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandmenu/defaultcs.aspx?product=grid

All the best,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
FLIDEV
Top achievements
Rank 2
answered on 23 May 2012, 02:23 PM
Hi,

I've tried the following function to set the scrollheight in the OnGridCreated-Event, but it dose not work:

            function SetGridH() {
 
                var oGrid = $find("<%= SOExplorer.ClientID %>");
                if (oGrid != null) {
                    var scrollArea = oGrid.GridDataDiv;
                    scrollArea.style.height = "250px";
                    oGrid.repaint();
                }
            }

Detlef! 

0
Tsvetina
Telerik team
answered on 28 May 2012, 11:50 AM
Hi Detlef,

I tried your code in a test project and it worked as expected on my side. I am attaching the page for your reference. Can you tell what is different on your side?

Regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Suneco
Top achievements
Rank 2
Answers by
Dimo
Telerik team
FLIDEV
Top achievements
Rank 2
Tsvetina
Telerik team
Share this question
or