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

System.InvalidCastException in Slider Control

6 Answers 119 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Adam Beal
Top achievements
Rank 1
Adam Beal asked on 15 Jul 2009, 06:09 PM
The slider control seems to work fine on normal use but if I click it rapidly and repeatedly I inevitebly will eventually generate a System.InvalidCastException at some point. Here is the stack trace it is all in the control:

<br />EXCEPTION

Exception Type System.InvalidCastException

Source: Telerik.Web.UI

Message: Specified cast is not valid.

Stack Trace: at Telerik.Web.UI.RadSlider.LoadClientState(Dictionary`2 clientState)

at Telerik.Web.UI.RadDataBoundControl.LoadPostData(String postDataKey, NameValueCollection postCollection)

at Telerik.Web.UI.RadSlider.LoadPostData(String postDataKey, NameValueCollection postCollection)

at Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)

at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Please advise...

6 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 20 Jul 2009, 08:11 AM
Hello Adam Beal,
I noticed that you have started another forum thread about problem with a RadSlider control in an UpdatePanel, in case there is a RadToolTipManager on the page - http://www.telerik.com/community/forums/aspnet-ajax/slider/slider-movement-causing-random-getclientrects-errors.aspx.

I have already answered this post. Could you please check whether the suggested changes fix this problem as well? In case those do not make a difference, could you please post the code of your page here so that I can test it locally and find what causes the problem?

Sincerely yours,
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
Adam
Top achievements
Rank 1
answered on 20 Jul 2009, 11:52 AM
No this is a seperate issue. The other one we resolved by removing the RadToolTipManager entirely from the page. However, even with the RadToolTipManager removed we can cause the error I described here by in the RadSlider by clicking and dragging too rapidly.
0
Tsvetie
Telerik team
answered on 20 Jul 2009, 02:41 PM
Hello Adam,
As I am not able to reproduce the problem locally, I will need the code of your page, exact version number of the Telerik.Web.UI assembly that you use and detailed steps that I need to follow in order to reproduce the problem.

Below is the code of my test page:
<%@ Page Language="C#" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head id="Head1"
    <title></title
 
    <script runat="server" type="text/C#"
        protected void RadSlider1_ValueChanged(object sender, EventArgs e) 
        { 
 
        } 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"
        <ContentTemplate> 
            <telerik:RadSlider ID="RadSlider1" runat="server" AutoPostBack="true" OnValueChanged="RadSlider1_ValueChanged"
            </telerik:RadSlider> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
     
    </form> 
</body> 
</html> 

Sincerely yours,
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
Thijs
Top achievements
Rank 1
answered on 21 Jun 2010, 03:41 PM
Hello,

I experienced the same problem: I also occassionally get an InvalidCastException when clicking in a slider.

The test page as posted by the Telerik team works fine for me, but the problem occurs with discrete sliders (ItemType="Item").
Using the test page below and rapidly clicking close to the boundary between two items results in the reported InvalidCastException. The slider appears to be in between values (see attached screenshot)

Kind regards,
Thijs

<%@ Page Language="C#" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head id="Head1"
    <title></title
 
    <script runat="server" type="text/C#">  
        protected void RadSlider1_ValueChanged(object sender, EventArgs e) 
        { 
 
        }  
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
        <asp:UpdatePanel ID="UpdatePanel1" runat="server"
            <ContentTemplate> 
            <telerik:RadSlider ID="RadSlider1" runat="server" ItemType="Item" AutoPostBack="true" OnValueChanged="RadSlider1_ValueChanged"
                    <Items> 
                        <telerik:RadSliderItem Text="1" Value="1" runat="server"/> 
                        <telerik:RadSliderItem Text="2" Value="2" runat="server"/> 
                        <telerik:RadSliderItem Text="3" Value="3" runat="server"/> 
                        <telerik:RadSliderItem Text="4" Value="4" runat="server"/> 
                    </Items> 
                </telerik:RadSlider> 
            </ContentTemplate> 
        </asp:UpdatePanel> 
    </form> 
</body> 
</html> 
 
0
Tsvetie
Telerik team
answered on 23 Jun 2010, 01:16 PM
Hello Thijs,
I tried to reproduce the problem you describe with the provided code, but to no avail. Could you please open a new support ticket and send me a simple running project, demonstrating the problem you have? It will be best if you send video capture as well, showing the steps you follow in order to reproduce it with the test project?

Kind regards,
Tsvetie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thijs
Top achievements
Rank 1
answered on 24 Jun 2010, 11:14 AM
Before opening a support ticket for this issue, I upgraded to the latest RadControls version (2010 Q1 519). It appears the problem is fixed in that version.

Cheers,
Thijs
Tags
Slider
Asked by
Adam Beal
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Adam
Top achievements
Rank 1
Thijs
Top achievements
Rank 1
Share this question
or