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

RibbonBar DropDownList enable and set selected

3 Answers 95 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Bastian
Top achievements
Rank 1
Bastian asked on 19 Jan 2016, 08:37 AM

Hi,

 

I'm having problems with the RibbonBarDropDown. I'm having two RibbonBarDropDowns and as soon as in one is a specifc item selected, the other gets enabled.

I'm using RadAjaxManger and the "OnClientDropDownSelectedIndexChanged" event to do the ajax request.

In my code behind i'm doing the following:

List<string>boxValues = ViewModel.GetBoxValues();
 
SecondBox.Items.Clear();
SecondBox.Items.AddRange(boxValues.Select(x => new RibbonBarListItem() {Text = x}));
if(boxValues.Count > 0)
{
    SecondBox.Enabled = true;
    SecondBox.SelectedIndex = 0;
}
else
{
    SecondBox.Enabled = false;
}

 

Everything is working fine except setting the selectedIndex. The selectedIndex is only set to 0 if the RibbonBarDropDown was enabled before.

Any suggestions what i'm doing wrong?

3 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 21 Jan 2016, 12:51 PM
Hello Bastian,

If I understand you well you are not able to set SecondBox.SelectedIndex = 0; after SecondBox.Enabled = false;. We have tested the scenario locally and even disabled, the DropDown allows to change its selected index from the code-behind. Please, let us know if we are missing something in this case.

You could also post here the declaration of your control in the markup and the OnClientDropDownSelectedIndexChanged handler that you have implemented. This way, we will be able to help you more accurately.

Regards,
Veselin Tsvetanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Bastian
Top achievements
Rank 1
answered on 26 Jan 2016, 08:09 AM

Hello Veselin,

 

I found a solution for my problem. I had a databinding for the "SecondBox.SelectedIndex", setting the bound property to 0 and the setting the SecondBox enabled worked fine.

 

Anyways, thanks for your fast response!

0
Veselin Tsvetanov
Telerik team
answered on 26 Jan 2016, 11:23 AM
Hello Bastian,

Thank you for getting back to us and letting us know that you have solved this issue.

Regards,
Veselin Tsvetanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
RibbonBar
Asked by
Bastian
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Bastian
Top achievements
Rank 1
Share this question
or