Dynamic Slider crazy

5 posts, 1 answers
  1. Daniel Botero Correa
    Daniel Botero Correa avatar
    32 posts
    Member since:
    Oct 2009

    Posted 15 Dec 2009 Link to this post

    Hi everybody,

    I've a problem with a slider control, the problem is the next:

    When i initialize the Slider control with the code below, it's good bound but when i do postback on my page, the slider change the positions and values' RadSliderItems, Example:

    |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  | -> item selected = 1 week.SelectedItem.Value  = 1

    i do post back (Change value item 1 = 2, why? i don't know)

    |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  | -> item selected = 1 week.SelectedItem.Value = 2

    i do post back (Change position all items and change value item 2, why? i don't know)

    |  2  |  3  |  4  |  5  |  6  |  7  |  8  | 1 | -> item selected = 2 week.SelectedItem.Value = 3

    So, i'm not never sure about values' items and the position change...

    Thanks....

    Code ASP:

    <telerik:RadSlider ID="week" runat="server" AnimationDuration="400" 
           Height="70px" ItemType="item" Width="350px" > 
    </telerik:RadSlider> 


    Code CS:

       protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                initialize_week();    
            } 
        }     
     
     
        public void initialize_week() 
        { 
            for (int i = 7; i >= 0; i--) 
            { 
                String value = 
                        DateTime.Now.AddDays((-7) * i).ToString(); 
                RadSliderItem item = new RadSliderItem( 
                    DateTimeTreatment.GetWeekNumber( 
                        DateTime.Now.AddDays((-7) * i)).ToString(),value); 
                 
     
                week.Items.Add(item); 
                week.DataBind(); 
            } 
        } 
  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 17 Dec 2009 Link to this post

    Hello Daniel Botero Correa,
    We are aware of this problem - it is actually a problem in the SelectedItem and SelectedItems properties. Until we fix the problem, you should use the following approach to get the value of the selected item, instead of SelectedItem.Value:
    SelectedItemValue.Text = week.Items[week.Value].Value;

    Greetings,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel Botero Correa
    Daniel Botero Correa avatar
    32 posts
    Member since:
    Oct 2009

    Posted 17 Dec 2009 Link to this post

    Hi Tsvetie,

    Thanks, i don't understand why, but it works, i can get the selected item's value and the control doesnt disarray.
    it's strange but that works.

    Thanks.
    Daniel BOTERO CORREA
    Induct
  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 22 Dec 2009 Link to this post

    Hello Daniel Botero Correa,
    Just to let you know that we have fixed the problem with the SelectedItem and SelectedItems properties and the fix is part of the latest internal build that you can download from your account. The version number of the build is 2009.3.1221.

    All the best,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Daniel Botero Correa
    Daniel Botero Correa avatar
    32 posts
    Member since:
    Oct 2009

    Posted 22 Dec 2009 Link to this post

    Hello Tsvetie,

    Thanks, i will do a dll's upgrade in my project or when my enterprise
    buys the controls, i will do it also.

    Thanks.
    Daniel BOTERO CORREA
    Induct
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017