Fluid Slider Issue, can't set 100% width dynamically

3 posts, 0 answers
  1. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2014

    Posted 09 Sep 2015 Link to this post

    I'm trying to do a fluid slider where it adjust to screen size. According to the fluid design documentation, if I were to add the control on page, I simply need to set: Width="100%" RenderMode="Lightweight":

    http://docs.telerik.com/devtools/aspnet-ajax/controls/slider/mobile-support/responsive,-adaptive-and-elastic-capabilities#fluid-design-with-radslider

    This work fine, but I need to create the sliders dynamically. The problem here is when creating in code behind, the Width property is integer only, I can't set to percent, so it can only be set to pixels. Any workaround?

    Thanks

    Aaron

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 11 Sep 2015 Link to this post

    Hi Aaron,

    I just tried the following code which seemed to work fine for me:

    <asp:PlaceHolder ID="Placeholder1" runat="server" />
    protected void Page_Load(object sender, EventArgs e)
    {
        RadSlider sl = new RadSlider();
        sl.ID = "Slider1";
        sl.RenderMode = RenderMode.Lightweight;
        sl.Width = Unit.Percentage(100);
        Placeholder1.Controls.Add(sl);
    }

    Could you see if it is OK on your end as well? What is important is that the RenderMode is set to Lightweight before the Width property is evaluated.

    Also, can you confirm you are using the latest version of the controls (Q2 2015 SP2 at the time of writing)?

    Regards,

    Marin Bratanov
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2014

    Posted 23 Oct 2015 in reply to Marin Bratanov Link to this post

    This worked. Really appreciate it!
Back to Top