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

Value is restored

2 Answers 56 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Elin Berg
Top achievements
Rank 1
Elin Berg asked on 17 Feb 2009, 08:17 PM
Hi!

I have put five sliders in a div with the style display: none. In the page_load I set the value to 70 for one slider and 30 for another, the other three is set to 0. When I push a button I will check so the value of the sliders is 100, but when I do this all sliders value is 0. Why? If I switch to the layer that is hidden from the beginning the sliders value is correct and the sum is correct if I push the button. I have made a repaint for the sliders when the layer is shown, can I do that at serverside too?

On client-side:

<

 

telerik:RadSlider runat="server" ID="slShareGlobal" OnClientValueChange="HandleValueChangeShareGlobal"

 

OnClientLoaded="HandleValueChangeShareGlobal" Length="318" Skin="Telerik" />

 

 


On server-side:
Initiating slider:

slShareGlobal.Value = 70

;

Checking value:

 

 

 

int 

 

shareGlobal = (int)slShareGlobal.Value;

 

 

 

 

 

 

 

/Elin

2 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 20 Feb 2009, 09:21 AM
Hello Elin,
I used the information you have provided to prepare a simple test page. However, the Value of the RadSliders was correct. I have attached my test page for your reference - for the test, I used version 2008.3.1314 of the suite. Could you please prepare and send me a simple running project, demonstrating the problem, so that I can research what is causing it?

Regards,
Tsvetie
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Elin Berg
Top achievements
Rank 1
answered on 20 Feb 2009, 10:29 AM
Hi!

I modified the files a little bit. The problem occurs when I add another div with sliders. The new div has the style display:block. I have solved the problem temporarily by making the div display: block when loading the slider and then directly after making it display: none again.

/Elin

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
 
    <script type="text/javascript">  
        function HandleValueChangeRadSlider1(sender, eventArgs)  
        {  
            $get("RadSlider1Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider2(sender, eventArgs)  
        {  
            $get("RadSlider2Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider3(sender, eventArgs)  
        {  
            $get("RadSlider3Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider4(sender, eventArgs)  
        {  
            $get("RadSlider4Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider5(sender, eventArgs)  
        {  
            $get("RadSlider5Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider6(sender, eventArgs)  
        {  
            $get("RadSlider6Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider7(sender, eventArgs)  
        {  
            $get("RadSlider7Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider8(sender, eventArgs)  
        {  
            $get("RadSlider8Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider9(sender, eventArgs)  
        {  
            $get("RadSlider9Value").value = sender.get_value();  
        }  
        function HandleValueChangeRadSlider10(sender, eventArgs)  
        {  
            $get("RadSlider10Value").value = sender.get_value();  
        }  
    </script> 
 
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <div style="display: block;">  
        <div style="display: inline-block;">  
            <telerik:RadSlider runat="server" ID="RadSlider6" OnClientValueChange="HandleValueChangeRadSlider6" 
                OnClientLoaded="HandleValueChangeRadSlider6" /> 
            <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
                id="RadSlider6Value" /> 
        </div> 
        <div style="display: inline-block;">  
            <telerik:RadSlider runat="server" ID="RadSlider7" OnClientValueChange="HandleValueChangeRadSlider7" 
                OnClientLoaded="HandleValueChangeRadSlider7" /> 
            <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
                id="RadSlider7Value" /> 
        </div> 
        <div style="display: inline-block;">  
            <telerik:RadSlider runat="server" ID="RadSlider8" OnClientValueChange="HandleValueChangeRadSlider8" 
                OnClientLoaded="HandleValueChangeRadSlider8" /> 
            <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
                id="RadSlider8Value" /> 
        </div> 
        <div style="display: inline-block;">  
            <telerik:RadSlider runat="server" ID="RadSlider9" OnClientValueChange="HandleValueChangeRadSlider8" 
                OnClientLoaded="HandleValueChangeRadSlider9" /> 
            <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
                id="RadSlider9Value" /> 
        </div> 
        <div style="display: inline-block;">  
            <telerik:RadSlider runat="server" ID="RadSlider10" OnClientValueChange="HandleValueChangeRadSlider10" 
                OnClientLoaded="HandleValueChangeRadSlider10" /> 
            <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
                id="RadSlider10Value" /> 
        </div> 
    </div> 
    <div style="display: none;">  
        <telerik:RadSlider runat="server" ID="RadSlider1" OnClientValueChange="HandleValueChangeRadSlider1" 
            OnClientLoaded="HandleValueChangeRadSlider1" /> 
        <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
            id="RadSlider1Value" /> 
        <telerik:RadSlider runat="server" ID="RadSlider2" OnClientValueChange="HandleValueChangeRadSlider2" 
            OnClientLoaded="HandleValueChangeRadSlider2" /> 
        <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
            id="RadSlider2Value" /> 
        <telerik:RadSlider runat="server" ID="RadSlider3" OnClientValueChange="HandleValueChangeRadSlider3" 
            OnClientLoaded="HandleValueChangeRadSlider3" /> 
        <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
            id="RadSlider3Value" /> 
        <telerik:RadSlider runat="server" ID="RadSlider4" OnClientValueChange="HandleValueChangeRadSlider4" 
            OnClientLoaded="HandleValueChangeRadSlider4" /> 
        <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
            id="RadSlider4Value" /> 
        <telerik:RadSlider runat="server" ID="RadSlider5" OnClientValueChange="HandleValueChangeRadSlider5" 
            OnClientLoaded="HandleValueChangeRadSlider5" /> 
        <input type="text" style="width: 30px; float: left; margin-top: 15px" disabled="disabled" 
            id="RadSlider5Value" /> 
    </div> 
    <asp:Button ID="Button1" runat="server" Text="CheckValue" OnClick="Button1_Click" /> 
    <asp:Label ID="lblResult" runat="server"></asp:Label> 
    </form> 
</body> 
</html> 
 

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            RadSlider1.MinimumValue = 0;  
            RadSlider1.MaximumValue = 100;  
            RadSlider1.LargeChange = 1;  
            RadSlider1.Value = 30;  
 
            RadSlider2.MinimumValue = 0;  
            RadSlider2.MaximumValue = 100;  
            RadSlider2.LargeChange = 1;  
            RadSlider2.Value = 70;  
 
            RadSlider3.MinimumValue = 0;  
            RadSlider3.MaximumValue = 100;  
            RadSlider3.LargeChange = 1;  
            RadSlider3.Value = 0;  
 
            RadSlider4.MinimumValue = 0;  
            RadSlider4.MaximumValue = 100;  
            RadSlider4.LargeChange = 1;  
            RadSlider4.Value = 0;  
 
            RadSlider5.MinimumValue = 0;  
            RadSlider5.MaximumValue = 100;  
            RadSlider5.LargeChange = 1;  
            RadSlider5.Value = 0;  
 
            RadSlider6.MinimumValue = 0;  
            RadSlider6.MaximumValue = 100;  
            RadSlider6.LargeChange = 1;  
            RadSlider6.Value = 30;  
 
            RadSlider7.MinimumValue = 0;  
            RadSlider7.MaximumValue = 100;  
            RadSlider7.LargeChange = 1;  
            RadSlider7.Value = 70;  
 
            RadSlider8.MinimumValue = 0;  
            RadSlider8.MaximumValue = 100;  
            RadSlider8.LargeChange = 1;  
            RadSlider8.Value = 0;  
 
            RadSlider9.MinimumValue = 0;  
            RadSlider9.MaximumValue = 100;  
            RadSlider9.LargeChange = 1;  
            RadSlider9.Value = 0;  
 
            RadSlider10.MinimumValue = 0;  
            RadSlider10.MaximumValue = 100;  
            RadSlider10.LargeChange = 1;  
            RadSlider10.Value = 0;  
 
              
        }  
    }  
 
    protected void Button1_Click(object sender, EventArgs e)  
    {  
        int sum = 0;  
        sum += RadSlider1.Value;  
        sum += RadSlider2.Value;  
        sum += RadSlider3.Value;  
        sum += RadSlider4.Value;  
        sum += RadSlider5.Value;  
 
        lblResult.Text = "Sum is: " + sum.ToString();  
    }  
}  
 
Tags
Slider
Asked by
Elin Berg
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Elin Berg
Top achievements
Rank 1
Share this question
or