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

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

2 Answers 26 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 09 Sep 2015, 01:17 PM

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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 11 Sep 2015, 07:23 AM

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
0
Aaron
Top achievements
Rank 1
answered on 23 Oct 2015, 01:46 PM
This worked. Really appreciate it!
Tags
Slider
Asked by
Aaron
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Aaron
Top achievements
Rank 1
Share this question
or