Hello,
I've implemented a slider control that is populated at runtime with a dynamic list of items. It works fine from a code point of view but the UI falls over in some cases when the number items exceeds the width parameter set for the slider. Needing to set this width parameter is essentially the cause of the problem. I want the width to be automatic dependent on the number of items loaded. Is this possible?
My code:
I've implemented a slider control that is populated at runtime with a dynamic list of items. It works fine from a code point of view but the UI falls over in some cases when the number items exceeds the width parameter set for the slider. Needing to set this width parameter is essentially the cause of the problem. I want the width to be automatic dependent on the number of items loaded. Is this possible?
My code:
<telerik:RadSlider ID="sldrSurvey" runat="server" /> |
private void PopulateSlider() |
{ |
sldrSurvey.ItemType = SliderItemType.Item; |
sldrSurvey.Height = Unit.Pixel(40); |
sldrSurvey.Width = Unit.Pixel(300); // I don't want to set this |
sldrSurvey.Skin = "Vista"; |
HashList<int, string> list = (HashList<int, string>)ValueList; |
if (list.Count != 0) |
{ |
foreach (KeyValuePair<int, string> item in list) |
{ |
RadSliderItem sliderItem = new RadSliderItem(); |
sliderItem.Text = item.Value; |
sliderItem.Value = item.Key.ToString(); |
sldrSurvey.Items.Add(sliderItem); |
} |
} |
sldrSurvey.DataBind(); |
} |