Hi, I'd like to be able to use the slider to quickly and easily change date ranges. Is this possible? Do you have an example somewhere?
Thanks!
2 Answers, 1 is accepted
0
Hristo Germanov
Telerik team
answered on 13 Jun 2011, 10:31 AM
Hi Christopher Ronak,
Thank you for contacting us.
Unfortunately, the Slider/RangeSlider do not support this functionality. You can set only number values for the Slider/RangeSlider:
<%= Html.Telerik().Slider<int>()
.Name("SliderYears")
.Min(2000)
.Max(2020)
%>
All the best,
Hristo Germanov
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
1) I have a view with the slider defined as follows
@{
Html.Telerik().RangeSlider<int>()
.Name("DateRange")
.Max(400)
.Min(0)
.LargeStep(7)
.Values(ViewBag.StartRange, ViewBag.EndRange)
.Orientation(SliderOrientation.Horizontal)
.Render();
}
On the page I also a window load function defined as follows. This gets the slider, and replaces all the numeric values with dates as calculated via an offset.
$(window).load(function() {
varcol = $("#timewrapper .t-tick-large .t-label")
varfDate = newDate(2011, 5, 27);
for(vari = 0; i < col.length; i++) {
varj = (i < 1) ? 0 : 7;
fDate.setDate(fDate.getDate() + j);
vard = fDate.getDate();
varm = fDate.getMonth() + 1;
d = (d<10)?"0"+ d:d;
m = (m<10)?"0"+ m:m;
vartxt = m+ "/"+ d;
$(col[i]).text(txt);
}
});
In the controller when you receive the two values for the slider, you just need to translate them back against the offset again to get the actual date values. Below is a snippet of my controller code