Drag and click on a slider with items dont work the same

2 posts, 1 answers
  1. Andreas Selling
    Andreas Selling avatar
    20 posts
    Member since:
    May 2009

    Posted 13 Jul 2010 Link to this post

    Hello

    I have a slider that works great when I click on it but if I drag the slider to a position it does a postback and the selected slider item always go back to the previous position.

    If I drag the slider to a position I want it to be handled just as if I click on a position.

    Here is some code:
    RadSlider assesmentSlider = (RadSlider)e.Item.FindControl("AssesmentSlider");
                assesmentSlider.ItemType = SliderItemType.Item;
                //the databinding of the slider
                Vklass.IUP.MatrixAssesment assesment = ((Vklass.IUP.MatrixAssesment)e.Item.DataItem);
                assesmentSlider.Items.Add(new RadSliderItem("Inget", ""));
                RadSliderItem sliderItem1 = new RadSliderItem("1", assesment.Text1);
                assesmentSlider.Items.Add(sliderItem1);
                assesmentSlider.Items.Add(new RadSliderItem("2", assesment.Text2));
                assesmentSlider.Items.Add(new RadSliderItem("3", assesment.Text3));
                assesmentSlider.Items.Add(new RadSliderItem("4", assesment.Text4));
                assesmentSlider.Items.Add(new RadSliderItem("5", assesment.Text5));
                assesmentSlider.ViewStateMode = System.Web.UI.ViewStateMode.Enabled;
                assesmentSlider.AutoPostBack = false;
      
                //The Javascript
                assesmentSlider.OnClientValueChanged = "OnClientValueChanged" + assesmentSlider.ClientID;
                assesmentSlider.OnClientSlideEnd = "OnClientSlideEnd" + assesmentSlider.ClientID;
                string tb1 = e.Item.FindControl("SelectedAssesmentValue").ClientID;
                string hiddenvalue = e.Item.FindControl("AssesmentText0").ClientID;
                string answered = e.Item.Parent.Parent.FindControl("Answered").ClientID;
                string jsfunction = "function " + assesmentSlider.OnClientValueChanged + "(obj,args){\nvar val = '" + hiddenvalue + "' \n$get('" + tb1 + "').value = $get(val.slice(0, -1)+obj.get_value()).value;\nif(obj.get_value() != '0'){\n $get('" + answered + "').value = 'True';\n }else{ \n$get('" + answered + "').value = 'False';\n }\n$get('UpdateDocument').click()\n}\n"; ;
                string jsfunction2 = "function " + assesmentSlider.OnClientSlideEnd + "(obj,args){\n obj.set_value=obj.get_trackPosition;\n}\n"; ;
  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 15 Jul 2010 Link to this post

    Hi Andreas Selling,
    The problem you describe is a result of the code that you execute in the handler for the slideEnd event of RadSlider:

    string jsfunction2 = "function " + assesmentSlider.OnClientSlideEnd + "(obj,args){ obj.set_value=obj.get_trackPosition;}";

    This code changes the set_value client-side method by replacing it with the get_trackPosition client-side method of the control. As a result, the value of the slider cannot change. In case you remove this code, the slider with behave as expected.

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