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

GridDropDownColumn displays more space than needed for records

3 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rob T
Top achievements
Rank 1
Rob T asked on 02 Feb 2010, 12:35 AM

Why does the GridDropDownColumn display larger than the count of items?


Check the RadComboBox Columns example.  You see 5 records in the combo, but the combo drop down extends another 4 or 5 records further of empty white space.

How do I fix this?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 02 Feb 2010, 08:55 AM
Hello Rob,

You can set the dropdownlist height based on number of items (if it is less than a particular count) in list after accessing the control in ItemDataBound event. Here is an example for setting the dropdownlist height.

CS:
 
   protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    {       
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem editItem = (GridEditableItem)e.Item; 
            RadComboBox combo = (RadComboBox)editItem["dropdowncolumn"].Controls[0]; 
            int itemsCount = combo.Items.Count; 
            combo.Height = Unit.Pixel(itemsCount*12); 
        } 
    } 

-Shinu.
0
Ben
Top achievements
Rank 1
answered on 20 Jul 2015, 06:29 PM
I'm running into this problem right now as well. Manually setting the height of the dropdownlist generally works but I've run into a ​case where it falls short. The drop down is getting populated with items where a few of them have enough text to cause the entry to line wrap, which ends up throwing off the resulting height of the dropdownlist. It's been a few years since this was posted. Is this still considered the best way to approach this problem in general and, if so, how would you recommend approaching this situation?
0
Pavlina
Telerik team
answered on 23 Jul 2015, 12:31 PM
Hello,

If you are using the latest version of Telerik UI for ASP.NET AJAX and you encounter a problem with grid DropDownColumn it will be best to send us a sample project which we can test locally. Another option is to send us the problematic code so we can examine it and advice you further.

Regards,
Pavlina
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Rob T
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Ben
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or