This is a migrated thread and some comments may be shown as answers.

[Value/Small Change/Large Change p.] issue

2 Answers 113 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Calin
Top achievements
Rank 1
Calin asked on 05 May 2009, 01:59 PM
Hi,

I want to use on of the following properties : Value/Small Change/Large Change
with a step size greater than 0 and less than 1.
How do i accomplish that?

Thank you!

<tr>
                            <td>
                                <telerik:RadSlider ID="SldTxtNrParts" runat="server"
                                    MaximumValue="20" OnClientValueChange="ChangeNumeric" Skin="Vista"
                                    ItemType="Tick" LargeChange="5" Height="30px">
                                </telerik:RadSlider>
                            </td>
                            <td>
                                <telerik:RadNumericTextBox ID="TxtNrParts" Runat="server"
                                Culture="French (France)" MinValue="0" MaxValue="20" ShowSpinButtons="True"
                                    Value="0">
                                    <IncrementSettings Step="0.5" />
                                    <FocusedStyle BorderColor="#663300" backcolor="#FF9900" borderstyle="Solid" />
                                    <NumberFormat DecimalDigits="1" />
                                    <ClientEvents OnValueChanged="ChangeSlider"/>
                                </telerik:RadNumericTextBox>
                            </td>

So, :) I want to bind a slider with a numeric control.

2 Answers, 1 is accepted

Sort by
0
shahab
Top achievements
Rank 1
answered on 06 May 2009, 01:02 AM
Hi Calin

I am assuming you would like the numeric up down to be bound to the slider and vice versa . If this is what you are after then you can achive this with the help of some javascript. I have put together some code for you.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">    
<script type="text/javascript"
 
       function HandleValueChangeGreenPercent(sender, eventArgs) {  
             
            $get("txtGreenPercent_text").value = sender.get_value();
            $get("txtGreenPercent_Value").value = sender.get_value();
            $get("txtGreenPercent").value = sender.get_value();
            
            
 
       }  
          
       function greenpercentchanged() {  
            var greenslider = $find("<%= sldrGreenPercent.ClientID %>");  
            var greentxtbox = $find("<%= txtGreenPercent.ClientID %>");  
            var sldvalue = greentxtbox.get_value();  
            greenslider.set_value(sldvalue);  
 
        }  
                  
          
        </script> 
 
 </telerik:RadCodeBlock> 
 
        <table> 
                <tr> 
                    <td> 
                    <!-- place the textbox for the slider here--> 
                    <telerik:RadNumericTextBox ID="txtGreenPercent" runat="server" ShowSpinButtons="true" MinValue="0" MaxValue="100" 
                                                    NumberFormat-KeepNotRoundedValue="true" BorderStyle="Solid" Width="100px" 
                                                    IncrementSettings-Step="0.01" ClientEvents-OnValueChanged="greenpercentchanged"   
                                                    ClientEvents-OnBlur="greenpercentchanged" > 
<IncrementSettings Step="0.01"></IncrementSettings> 
 
<ClientEvents OnBlur="greenpercentchanged" OnValueChanged="greenpercentchanged"></ClientEvents> 
 
                                                   <NumberFormat AllowRounding = "false" KeepNotRoundedValue="true"  DecimalDigits="2"/>  
                                                </telerik:RadNumericTextBox> 
                     </td> 
                </tr> 
            <tr> 
                <td> 
                    <telerik:RadSlider ID="sldrGreenPercent" runat="server" Value="0" LargeChange="5" 
                        SmallChange="1" Width="500" Height="60" MaximumValue="100" ItemType="Tick" TrackPosition="TopLeft" 
                        OnClientValueChange="HandleValueChangeGreenPercent"  
                        Skin="Telerik" /> 
                     
                </td> 
            </tr> 
        </table> 
 
 
 
If the above scenario is what you are after then feel free to drop me a line and we can sit down together and tidy it up.
You can see the online demo here :slider bound to numeric up down
Hope this helps.
Cheers
Shahab
0
Calin
Top achievements
Rank 1
answered on 06 May 2009, 07:05 AM
Thank you...
       I've accomplish the bounding issue.
       Lets presume that the numeric control has:  IncrementSettings-Step="0.07" . Whenever the numeric control is changed
       (incrementation: NumericControl.Value=0.14 / 0.21 /0.28), the SliderControl is also changed.But...
      
       Problem: The Value property of the SliderControl accepts only integer types. Although i've realized bidirectional binding
in a javascript, the slider doesn't recongnize float/double values . Slider control can not use (or maybe i don't know how) values: [SliderControl.Value > 0..SliderControl.Value <1]

      
Tags
Slider
Asked by
Calin
Top achievements
Rank 1
Answers by
shahab
Top achievements
Rank 1
Calin
Top achievements
Rank 1
Share this question
or