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

Dynamic Slider crazy

4 Answers 63 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Daniel Botero Correa
Top achievements
Rank 1
Daniel Botero Correa asked on 15 Dec 2009, 03:17 PM
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(); 
        } 
    } 

4 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 17 Dec 2009, 01:11 PM
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.
0
Daniel Botero Correa
Top achievements
Rank 1
answered on 17 Dec 2009, 01:42 PM
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
0
Tsvetie
Telerik team
answered on 22 Dec 2009, 09:56 AM
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.
0
Daniel Botero Correa
Top achievements
Rank 1
answered on 22 Dec 2009, 11:01 AM
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
Tags
Slider
Asked by
Daniel Botero Correa
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Daniel Botero Correa
Top achievements
Rank 1
Share this question
or