AJAX - How can I get SliderExtender to increments by .01

Discussion in 'ASP.NET 2.0' started by harryteckco, Jun 26, 2007.

  1. Hello!

    I am trying to use the SliderExtender with the most current release of the Ajax Toolkit. I have the


    Decimals="2"


    property set, however, when I increment the control from the web, it increments by 8 or 9. For example, when I slide the bar starting at 12.00, it increments to 12.09, then 12.17, 12.26, 12.34, 12.43, etc.


    The behavior I am looking for is to have it increment by .01, so starting at 12.00, I want to see the increment of 12.01, 12.02, 12.03, 12.04, etc.


    Does anyone know if this behavior is possible and how to achieve it?


    Thank you in advance,


    --Harry
     
  2. You need to set the value for the steps attibute which by defination is the number of discrete values inside the slider's range.

    See: http://daspstaff00.web120.discountasp.net/AJAXGAC/default.aspx (DASP AJAX control demo page)

    I have set Minimum:1 ,Maximum:12 and Steps: 12 .So the total range of 1 to 12 is divided into 12 steps,hence I get an increment of 1 . Unfortunately, i don?t think there is an attribute, where in you can set the increment directly.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Hi, Vikram.


    I tried several combos. I got it working to increment by 0.01 on a range from 0 - 1.00 with this set-up:


    <ajaxToolkit:SliderExtender
    ID="SliderExtender1"
    BehaviorID="txtDisplaySlider"
    TargetControlID="txtDisplaySlider"
    BoundControlID="txtDisplayValue"
    Orientation="Horizontal"
    EnableHandleAnimation="true"
    Decimals="2"
    Steps="100"
    Minimum="0"
    Maximum="1"
    runat="server">
    </ajaxToolkit:SliderExtender>


    However, when you change it to some other max like 2 or 5 or whatever, the increment gets throw off again. Any other ideas?
     
  4. As i had mentioned in my earlier post,the steps,max and min is what decides the increment value.So basically your increment will be :
    increment=max-min/steps

    so if max is 2 or 5 and steps is still 100 ,your incrment will be 2-1/100=0.01 and 5-1/100=0.04 respectively.

    Updated values on http://daspstaff00.web120.discountasp.net/AJAXGAC/default.aspx to min=4 ,max=5 and steps=100 so increment is still (5-4/100)=0.01

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Ok, now I realized I needed to make the control bigger to see the increment. I changed the length property of the control to a large number, like 700, and it made a large slider bar. That enabled the small increments of 0.01 via the mouse drag. Although,making the slider this large will not make a pretty web UI, at least I can get the increments I need.



    <ajaxToolkit:SliderExtender


    ID="SliderExtender1"


    BehaviorID="txtDisplaySlider"


    TargetControlID="txtDisplaySlider"


    BoundControlID="txtDisplayValue"


    Orientation="Horizontal"


    EnableHandleAnimation="true"


    Length="700"


    Decimals="2"


    Steps="400"


    Minimum="3"


    Maximum="7"


    runat="server">


    </ajaxToolkit:SliderExtender>


    Thanks!
     

Share This Page