Display intervals on Slider Extender

Last post 01-09-2009 12:18 PM by momoko. 4 replies.

Sort Posts:

  • Display intervals on Slider Extender

    12-31-2008, 1:32 PM
    • Member
      10 point Member
    • momoko
    • Member since 03-07-2007, 7:03 PM
    • Posts 16
    Hello, I need to display intervals(e.g. 0, 5, 10 etc) below SliderExtender control.  Does anyone know how to do it?   Thank you very much.

     

  • Re: Display intervals on Slider Extender

    01-02-2009, 1:31 AM
    Answer

    Hi,

    You can create div with absolute position to build interval information.

    Please check the below sample:

     

        <cc1:ToolkitScriptManager runat="Server" EnablePartialRendering="true" ID="ScriptManager1" />
        <div>
            <asp:TextBox ID="txtSlider" runat="server" Text='0' AutoPostBack="true" OnTextChanged="Slider1_TextChanged"
                Style="display: none" Height="16px" Width="500px" />
            <div style="position: absolute; height: 8px; width: 8px" id="value0">
                0
            </div>
            <div style="position: absolute; height: 8px; width: 8px" id="value1">
                5
            </div>
            <div style="position: absolute; height: 8px; width: 8px" id="value2">
                10
            </div>
        </div>
    
        <script type="text/javascript">
    
        function getLeft(e) {
            var offset = e.offsetLeft;
            if (e.offsetParent != null) offset += getLeft(e.offsetParent);
            return offset;
        }
        function pageLoad() {
    
            var text = $get('<%=txtSlider.ClientID %>');
     
            var slider_width = parseInt($find("sliderbehavior").get_Length().replace('px',''));
    
            $get('value0').style.left = parseInt(getLeft(text), 10)  + 'px';
            $get('value2').style.left = parseInt(getLeft(text), 10) + slider_width + 'px';
            $get('value1').style.left = (parseInt(getLeft(text), 10) + slider_width) / 2 + 'px';
            
            
        }
        </script>
    
        <cc1:SliderExtender ID="slider" BehaviorID="sliderbehavior" runat="server" TargetControlID="txtSlider" Orientation="Horizontal" Length="500" 
            Minimum="0" Steps='3' Maximum='10' />
    
     

    Vince Xu
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Display intervals on Slider Extender

    01-02-2009, 2:10 PM
    • Star
      10,558 point Star
    • Danny117
    • Member since 12-16-2008, 2:30 PM
    • Royal Oak Michigan USA
    • Posts 1,837

    vince always has awesome answers.  How about you put a background that has a picture of the intervals on it.

     

     

     

    Good Luck



  • Re: Display intervals on Slider Extender

    01-04-2009, 9:06 PM

    Hi,

    You can use a background image instead of the number in div controls.


    Vince Xu
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Display intervals on Slider Extender

    01-09-2009, 12:18 PM
    • Member
      10 point Member
    • momoko
    • Member since 03-07-2007, 7:03 PM
    • Posts 16
    Sorry for my late response but thank you very much for your help, Vince and Danny. Vince’s code works fine but I also need to display a scale with number on the slider.  As you guys suggested, I could use a background image with scale and interval…..but I don’t know what kind of image I need to create and how these images and CSS work together.   Could it be possible that you could put sample of images? I appreciate your help very much!

     

Page 1 of 1 (5 items)