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

RadSlider - problem when switching between IsSelectionRangeEnabled true and false

7 Answers 125 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 02 Dec 2008, 05:22 AM
Hi,

I have experienced a couple of issues with the RadSlider when switching between 

IsSelectionRangeEnabled=true and false.

The sequence is as follows...
If I start with IsSelectionRangeEnabled=false and then in code behind set it to true two things happen

1. The SelectionStart property gets set to the Value property regardless of what it is set to in the code and
2. The ValueChanged event for the left SelectionStart handle is dissabled. The right handle (SelectionEnd) still works fine.

 

 


Any advice would be appreciated.

 

Thanks
Steve

7 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 02 Dec 2008, 01:42 PM
Hi Stephen,
I was able to reproduce both problems and forwarded them to our developers. We will fix both of them for the next update of the suite, namely Q3 2008 SP2. Unfortunately, for the time being, I can offer you a workaround only for the first problem - just to set the Value property to the same value as the SelectionStart property.

RadSlider1.SelectionStart = 20;  
RadSlider1.Value= 20; 

I have updated your Telerik points for bringing these issues to our attention.

All the best,
Tsvetie
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Stephen
Top achievements
Rank 1
answered on 03 Dec 2008, 04:26 AM
Hi Tsvetie,

Thanks for the response. Found the first solution already.

I have a partial solution for the second problem and was hoping you could help me fill in the rest. 

I disabled the AutoPostBack from the Slider. Instead I did an ajaxRequest from the OnClientSlideEnd event. This takes care of the lost event from the left handle. I get the correct changed values back from the Slider. However the left handle snaps back to the original position. For example

1) Slider is swicthed between the modes to create the problem.
2) Slider left handle starts at position 100
3) Slider left handle moved to 200
4) ajaxRequest called and position correctly returned as 200 (update other controls on page to reflect this)
5) Left handle snaps back to postion 100

Is there something in ViewState I need to change manually from the ajaxRequest handler?

Regards
Steve
0
Stephen
Top achievements
Rank 1
answered on 03 Dec 2008, 06:10 AM
Hi Tsvetie,

Following on from my previous email I tried setting up 2 sliders - one in each configuration - then toggling the Visible property for them according to which slider mode I wanted. I found that the display behaved oddly. Rather than hiding one and showing the other it would hide both or show both. Tried with the sliders in separate divs or the same div.

Any eta on when the SP2 will be out?

Regards
Steve

0
Tsvetie
Telerik team
answered on 03 Dec 2008, 01:21 PM
Hi Stephen,
We do not have an exact date for SP2 - it will be available for download in about a month. Instead of implementing a complex workaround, if it is an option for you, I can send you an internal build with the necessary changes to the RadSlider control. In you decide to use this option, please open a new support ticket and I will send you the hotfix.

Regarding the Visible property of the RadSlider - I was not able to reproduce this one. I tested with the following code:
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadSlider ID="RadSlider1" runat="server"></telerik:RadSlider> 
        <telerik:RadSlider ID="RadSlider2" runat="server"></telerik:RadSlider> 
          
        <asp:Button ID="Button1" runat="server" Text="Switch_IsSelectionRangeEnabled" OnClick="Button1_Click" /> 
    </form>      
</body> 

code-behind:
protected void Button1_Click(object sender, EventArgs e)  
{  
    RadSlider2.Visible = !RadSlider2.Visible;  

If you could send me the code that demonstrates this problem, I will do my best to find the cause for it.

Greetings,
Tsvetie
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Stephen
Top achievements
Rank 1
answered on 04 Dec 2008, 03:51 AM
Hi Tsvetie,

Please see below the code that replicates the issue.

aspx code

 

<form id="form2" runat="server">

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="CheckBox2">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadSlider1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<div>

 

 

<div>

 

 

<div style="float:left"><telerik:RadSlider runat="server" ID="RadSlider1" /></div>

 

 

<div style="float:left"><telerik:RadSlider runat="server" ID="RadSlider2" IsSelectionRangeEnabled="true" /></div>

 

 

<div style="float:right"><asp:CheckBox ID="CheckBox2" runat="server" Text="Toggle sliders" TextAlign="Left" oncheckedchanged="CheckBox2_CheckedChanged" AutoPostBack="true" /></div>

 

 

</div>

 

 

</div>

 

 

</form>

 


cs code

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

if (!IsPostBack)

 

{

CheckBox2.Checked =

true;

 

RadSlider1.Visible =

false;

 

RadSlider2.Visible = !RadSlider1.Visible;

RadSlider1.MaximumValue = 150;

RadSlider1.Value = 100;

RadSlider2.MaximumValue = 100;

RadSlider2.MinimumValue = 0;

RadSlider2.SelectionStart = 20;

RadSlider2.SelectionEnd = 35;

}

}

 

protected void CheckBox2_CheckedChanged(object sender, EventArgs e)

 

{

RadSlider1.Visible = !CheckBox2.Checked;

RadSlider2.Visible = CheckBox2.Checked;

}



If you remove the line 

<telerik:AjaxUpdatedControl ControlID="RadSlider1" /> from the ajax manager the problem goes away (ie sliders show and hide correctly. With this line in one slider does not hide.

Regards
Steve

 

0
Tsvetie
Telerik team
answered on 04 Dec 2008, 08:44 AM
Hi Stephen,
Thank you for the provided code - it helped me understand the problem. It is caused by the fact that you expect two RadSliders to get updated during the AJAX request, but you have configured the RadAjaxManager to actually update only the first.

In order for the two RadSlider controls to get updated, you need to modify your RadAjaxManager definition the following way:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="CheckBox2">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadSlider1" /> 
                <telerik:AjaxUpdatedControl ControlID="RadSlider2" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 

I have attached my test page for your reference as well.

Kind regards,
Tsvetie
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Stephen
Top achievements
Rank 1
answered on 04 Dec 2008, 10:49 PM
Hi Tsvetie,

So simple - I took the code from the original single RadSlider mode switching implementation to make the dual RadSlider-one-of-each solution. I missed the extra ajaxmanager line.

Thanks for the hotfix.
Steve
Tags
Slider
Asked by
Stephen
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Stephen
Top achievements
Rank 1
Share this question
or