We are using multiple slider extenders on a page, and on some of them it kind of skips steps. For example, one slider has the values minimum 0 and maximum 10, and the steps property is set to 10. But when you slide it, it always skips 5, so you go from 1-4
and then skip 5 and then 6-10. So you can never choose 5.
The same happens on many of the sliders on the page (even though they have different minimums, maximums and step values).
The code looks fine, but post whats the value in MusicSteps. Also Try changing the BoundControlID to the text box and try setting value 5 to the textbox and see if the slider changes position.
Cheers,
Gopakumar
| Please click “Mark as Answer” on the post(s) if it helps |
I did try the solution but it only fix for situation where decimal are handled. In my case there is no decimals.
I came up wit hthe following:
I've found that the setting of the steps are "discrete steps", what it's actually means is left to be clearly defined (for my understanding). But when then minimum value of the slider is 0 ,then you need to add 1 to the actual value of your steps.
i.e : if slider1.Max =5 and slider1.Min =0 and slider1.steps=5 then the value 2 will be skipped in favor of 3.
The rationale behind if im right is that it actually divide the range in 2 equal part and if the mean point is a decimal it rounds it to the higher integer and jump that one.
raymon2683
Member
6 Points
25 Posts
ASP.NET AJAX Slider skips steps
May 03, 2012 05:25 PM|LINK
We are using multiple slider extenders on a page, and on some of them it kind of skips steps. For example, one slider has the values minimum 0 and maximum 10, and the steps property is set to 10. But when you slide it, it always skips 5, so you go from 1-4 and then skip 5 and then 6-10. So you can never choose 5.
The same happens on many of the sliders on the page (even though they have different minimums, maximums and step values).
Any idea on what we have messed up?
<p> <span class="helpText">Number Music stream per hour</span> <asp:HyperLink ID="lnkMusicStream" runat="server"></asp:HyperLink> <span class="maptextimg"> <img class="helpTxtImg" src="~/html/images/buttons/help_icon.png" alt="help" title="<%=getNoOfMusicStreamHelpText() %>" /> </span> <span class="numbers"> <asp:Label ID="lblMusicIntervals" runat="server" /> </span> </p> <p> <span> <asp:TextBox ID="txtMusicStream" runat="server" AutoPostBack="true" /> <span class="size"> <asp:Label ID="lbltxtMusicStream" runat="server" /></span> <ajaxToolkit:SliderExtender ID="txtMusicStream_SliderExtender" runat="server" TargetControlID="txtMusicStream" BehaviorID="txtMusicStream" BoundControlID="lbltxtMusicStream" EnableKeyboard="true" TooltipText="{0}" HandleCssClass="handleBar" HandleImageUrl="~/html/images/buttons/handle.png"> </ajaxToolkit:SliderExtender> </span> </p> txtMusicStream_SliderExtender.Maximum = Sliders.GetSliderValues(SliderType.Streaming)["MaximumMusic"]; //10 txtMusicStream_SliderExtender.Minimum = Sliders.GetSliderValues(SliderType.Streaming)["MinimumMusic"]; //1ajaxToolkit ajax
gopakumar.r
Participant
959 Points
193 Posts
Re: ASP.NET AJAX Slider skips steps
May 03, 2012 05:49 PM|LINK
The code looks fine, but post whats the value in MusicSteps. Also Try changing the BoundControlID to the text box and try setting value 5 to the textbox and see if the slider changes position.
Gopakumar
| Please click “Mark as Answer” on the post(s) if it helps |
Song-Tian - ...
All-Star
43699 Points
4304 Posts
Microsoft
Re: ASP.NET AJAX Slider skips steps
May 04, 2012 09:22 AM|LINK
Hi,
Please refer to this thread: http://forums.asp.net/p/1794447/4942320.aspx/1?Re+SliderExtender+half+step+issue.
You are have the same issue.
Feedback to us
Develop and promote your apps in Windows Store
raymon2683
Member
6 Points
25 Posts
Re: ASP.NET AJAX Slider skips steps
May 04, 2012 02:07 PM|LINK
Thanks,
I did try the solution but it only fix for situation where decimal are handled. In my case there is no decimals.
I came up wit hthe following:
I've found that the setting of the steps are "discrete steps", what it's actually means is left to be clearly defined (for my understanding). But when then minimum value of the slider is 0 ,then you need to add 1 to the actual value of your steps.
i.e : if slider1.Max =5 and slider1.Min =0 and slider1.steps=5 then the value 2 will be skipped in favor of 3.
The rationale behind if im right is that it actually divide the range in 2 equal part and if the mean point is a decimal it rounds it to the higher integer and jump that one.
Song-Tian - ...
All-Star
43699 Points
4304 Posts
Microsoft
Re: ASP.NET AJAX Slider skips steps
May 07, 2012 08:25 AM|LINK
Hi,
Yes, you could edit the code as I said:
<script type="text/javascript"> Sys.Extended.UI.SliderBehavior.prototype._getNearestStepValue = function (value) { if (this._steps == 0) return value; var extent = this._maximum - this._minimum; if (extent == 0) return value; var delta = extent / (this._steps - 1); if (value / delta == 0.5) { return value; } else return Math.round(value / delta) * delta + this._minimum; }; </script>Feedback to us
Develop and promote your apps in Windows Store