problem in dropdownlistelement after collapsing ribbonbar

2 posts, 0 answers
  1. Suresh G
    Suresh G avatar
    9 posts
    Member since:
    Mar 2012

    Posted 24 Dec 2013 Link to this post

     I have a ribbon bar. It has ribbonbarbuttongroup and it has different elements like dropdownlistelement etc. we are creating  dropdownlistelements at run time. We are populating dropdownlistelements on form load. On form load, we are also hiding ribbon tab using '
    this.radribbonbar1.RibbonBarElement.Expanded = false;'. After execution of this line,  dropdownlistelement's items count has become 0 during debugging though items are showing in it. So its creating problem when we loop through dropdownlistelement.
    When i manually expand/collapse ribbon bar multiple times again items count become 0. One more thing, Suppose i selected some text in
    dropdownlistelement and expand/collapse ribbon bar one/two times, text is showing selected but during debugging no item is selected (When we loop through).

  2. George
    George avatar
    500 posts

    Posted 26 Dec 2013 Link to this post

    Hello Shantosh,

    Thank you for contacting Telerik Support.

    I am guessing that you are not directly adding items, instead you are assigning a DataSource to the RadDropDownListElement. If that is the case then this behavior is normal since the RadDropDownListElement tries to cache the values whenever possible, that is why the items are in the Items collection when the RibbonBarElement is expanded. As a workaround you can use the DataSource which you are assigning and iterate over it. For example if your DataSource is a List of integers you can cast the DataSource property of the RadDropDownListElement and iterate it.

    The caching and reusing of the data also raises the matter with the selected item. One possible way to workaround this behavior is to subscribe to the SelectedIndexChanged of the RadDropDownList and in a variable or other more advanced caching method to save the last selected item if the selected index is not -1. This way even when the ribbon is collapsed you will know what your selected item is.

    I am attaching a sample project which demonstrates this above described functionality.

    If you have any further questions or queries, do not hesitate to contact us.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top