I have found, and tried, some of the solutions for this problem in this forum. I'm somewhat new to Telerik controls, and I'm sure this is part of my problem, but what I want to do should not be this difficult!
I need to limit the height of a combobox when click (dropdown).
Here is the code (copied right from a lising on this forum):
The first time I tried this I got a runtime error when I tried to calculate calculatedHeight. The error was that the method was "Object doesn't support this property or method". So I just put a hard value in there to see if that would work...NOPE, go the same error on the line trying to get the dropDownDiv.
I also tried sending in the name of the control directly instead of using the SENDER parameter...same thing happens.
This page is used in several other applications, and some of them cut off the bottom of the dropdown. All I need is a way to limit the height so that doesn't happen and the users can scroll to the bottom. Why is this so hard? In the web config it appears the controls are from Q3 2008, and that cannot change.
Can anyone see what the heck I'm doing wrong and/or point me to some documentation that actually works?
Thanks from a VERY frustrated developer.
Rich
I need to limit the height of a combobox when click (dropdown).
Here is the code (copied right from a lising on this forum):
//This function limits the size of the combo box dropdown size.
function OnClientDropDownOpeningHandler(sender, eventArgs)
{
//set the max allowed height of the combo
var MAX_ALLOWED_HEIGHT = 140;
//this is the single item's height
var SINGLE_ITEM_HEIGHT = 22;
//var calculatedHeight = ctlUserCombo.get_items().get_count() * SINGLE_ITEM_HEIGHT;
var dropDownDiv = sender.get_dropDownElement();
if (calculatedHeight > MAX_ALLOWED_HEIGHT)
{
setTimeout (
function () {
dropDownDiv.firstChild.style.height = MAX_ALLOWED_HEIGHT + "px";
}, 20
);
}
else
{
setTimeout (
function ()
{
dropDownDiv.firstChild.style.height = calculatedHeight + "px";
}, 20
);
}
}
I also tried sending in the name of the control directly instead of using the SENDER parameter...same thing happens.
This page is used in several other applications, and some of them cut off the bottom of the dropdown. All I need is a way to limit the height so that doesn't happen and the users can scroll to the bottom. Why is this so hard? In the web config it appears the controls are from Q3 2008, and that cannot change.
Can anyone see what the heck I'm doing wrong and/or point me to some documentation that actually works?
Thanks from a VERY frustrated developer.
Rich