How to remove vertical scroll bar for RadToolBarSplitButton

4 posts, 2 answers
  1. Stephane
    Stephane avatar
    27 posts
    Member since:
    Mar 2009

    Posted 22 Nov 2011 Link to this post

    Hi,
    I have a RadToolBarSplitButton where I set buttons in runtime.
    I calcule the dropdown height from the number of  button.
    
    But everyime the vertical scroll bar are visible.
    
    How do you remove this scroll bar ?
    
    
    int dropDownHeight = (int)(Annees.Buttons.Count * 25);
    if (dropDownHeight > 250)
    {
       dropDownHeight = 250;
       //show vertical scroll bar
    }
    else
    {
      //not show vertical scroll bar
    }
                             
    Annees.DropDownHeight = Unit.Pixel(dropDownHeight);
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Nov 2011 Link to this post

    Hello,

    If you set the DropDownHeight property of RadToolBarSplitButton, then it automatically shows vertical scrollbar. Inorder to remove vertical scrollbar you can try the following CSS.

    CSS:
    <style type="text/css">
    .RadToolBarDropDown_Default
      {
        overflow-y:hidden ! important;
      }
    </style>
     
    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 23 Nov 2011 Link to this post

    Hello Stephane,

    I think the better solution is that you change your code to something like this:

    int dropDownHeight = (int)(Annees.Buttons.Count * 25);
      
    if (dropDownHeight > 250)
    {   
        // set drop-down height, scroll bar is shown
        Annees.DropDownHeight = Unit.Pixel(250);  
    }
    else
    {  
        // don't set drop-down height, no scroll bar will be shown
        Annees.DropDownHeight = Unit.Empty;
    }

    Princy's solution will hide the scrollbar even when you need it to be there.

    I hope that helps.
  5. Stephane
    Stephane avatar
    27 posts
    Member since:
    Mar 2009

    Posted 23 Nov 2011 Link to this post

    Hi all,
    thanks for your help Kevin and Princy.

    It's ok for me.
Back to Top