Set drop down height of radcombobox dynamically

2 posts, 0 answers
  1. MRa
    MRa avatar
    16 posts
    Member since:
    Dec 2012

    Posted 03 Oct 2013 Link to this post

    i'm setting the scroll area of the radgrid dynamically on gridcreated:

                   var heightResolution = screen.height;
                    var screenHeight = heightResolution - (heightResolution * 0.40);

                    $get("content").style.height = screenHeight;

                    var scrollArea = sender.GridDataDiv;

                    scrollArea.style.height = screenHeight + "px";

    is there any way to do something similar with the drop down portion of the radcombobox?

    I'd like to set the height to a specific percentage of the page based on user's resolution.
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 08 Oct 2013 Link to this post

    Hi,

    Probably there are multiple approaches you can use, but here are two of them:
    • Get screen resolution on the server as described in this forum post and set the MaxHeight property of the combo in its OnInit event:
      protected void RadComboBox1_Init(object sender, EventArgs e)
      {
          RadComboBox1.MaxHeight = 300;
      }
    • Set the height of the combo on the client. For example in the OnClientDropDownOpened event:
      function OnClientDropDownOpened(sender, args) {
          setTimeout(function () {
              $('.rcbScroll.rcbWidth').height(60);
          }, 10);
      }

    Regards,
    Hristo Valyavicharski
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top