System.InvalidCastException in Slider Control

7 posts, 0 answers
  1. Adam Beal
    Adam Beal avatar
    4 posts
    Member since:
    Jul 2009

    Posted 15 Jul 2009 Link to this post

    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...

  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 20 Jul 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    3 posts
    Member since:
    Jun 2009

    Posted 20 Jul 2009 Link to this post

    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.
  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 20 Jul 2009 Link to this post

    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.
  6. Thijs
    Thijs avatar
    2 posts
    Member since:
    Oct 2007

    Posted 21 Jun 2010 Link to this post

    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> 
     
  7. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 23 Jun 2010 Link to this post

    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
  8. Thijs
    Thijs avatar
    2 posts
    Member since:
    Oct 2007

    Posted 24 Jun 2010 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017