RibbonBar DropDownList enable and set selected

4 posts, 0 answers
  1. Bastian
    Bastian avatar
    4 posts
    Member since:
    Jan 2016

    Posted 19 Jan Link to this post

    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?

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 21 Jan Link to this post

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

    Posted 26 Jan in reply to Veselin Tsvetanov Link to this post

    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!

  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 26 Jan Link to this post

    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
Back to Top