This is a migrated thread and some comments may be shown as answers.
Possible Breaking change from 2011 Q1 -> 2001 Q2 release
3 Answers 38 Views
This is a migrated thread and some comments may be shown as answers.
Thad
Top achievements
Rank 2
Thad asked on 14 Jul 2011, 05:36 PM
Hello Telerik,

We upgraded from the 2011 Q1 to the 2011 Q2 release yesterday and noticed that the following functionality in the RadComboBox has changed.

We create our own server control (SingleSelectRadComboBox) that derives from RadComboBox:

public sealed class SingleSelectRadComboBox : RadComboBox, ISingleSelectRadComboBox

In the constructor, we have the following properties set:
/// <summary>
/// Default constructor that sets up common control properties
/// </summary>
public SingleSelectRadComboBox()
{
    AllowCustomText = false;
    ChangeTextOnKeyBoardNavigation = true;
    EnableTextSelection = true;
    MarkFirstMatch = true;
    EmptyMessage = "Select...";
    CloseDropDownOnBlur = true;
    CollapseAnimation.Type = AnimationType.None;
    ExpandAnimation.Type = AnimationType.None;
 
    MaxHeight = Unit.Pixel(200);
    if (Width.Value == 0) { Width = Unit.Pixel(160); }
 
    OnClientFocus = "singleSelect_RadComboBox_Focus";
 
}

When we bind data to the RadComboBox using the Q1 release, the first item that was bound is selected in the dropdown and the SelectedIndex property is 0.  When we switched to Q2, the data is bound properly, but the SelectedIndex property is -1.

If we comment out the following three lines of code in our default constructor the control works the same between releases.
EnableTextSelection = true;
MarkFirstMatch = true;
EmptyMessage = "Select...";

I assume that this change is related to the following comment in the release notes:
  Added: Improved EmptyMessage to show regardless of the value of the AllowCustomText and EnableLoadOnDemand properties

Was the change I describe an intended or unintended side effect of the Q2 release?

Thanks!!
Thad

3 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 15 Jul 2011, 08:52 AM
Hello Thad,

Actually the change in functionality is intended because in order to show the empty message regardless of the other properties of RadComboBox, the selection must be cleared. Since this feature has been requested by a lot of people for a long time we finally decided to implement it.

You can easily work around this by selecting the first item after the combobox is bound to data (OnDataBound). Doing this is equivalent to the previous behavior, only that RCB did this internally.

We will update the respective places in our support resources to outline this change more clearly.

All the best,
Simon
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Thad
Top achievements
Rank 2
answered on 15 Jul 2011, 12:32 PM
Thank you, Simon. 

That is exactly the answer we expected and have already implemented the solution you suggest within our common data binding methods to resolve the issue.

/// <summary>
/// This is called to handle the common functionality of binding RadComboBoxes and RadListBoxes
/// </summary>
/// <param name="dataToBind"></param>
/// <param name="itemContainer"></param>
/// <param name="dataValueField"></param>
/// <param name="dataTextField"></param>
public static void BindRadControlItemContainer(IEnumerable dataToBind, ControlItemContainer itemContainer,
                                                string dataValueField, string dataTextField)
{
    itemContainer.DataSource = dataToBind;
    if (!string.IsNullOrEmpty(dataValueField))
    {
        itemContainer.DataValueField = dataValueField;
    }
    if (!string.IsNullOrEmpty(dataTextField))
    {
        itemContainer.DataTextField = dataTextField;
    }
    itemContainer.DataBind();
 
    // Ensure that the first item is selected as expected
    if (itemContainer is RadComboBox && dataToBind != null && ((RadComboBox)itemContainer).SelectedIndex == -1)
    {
        ((RadComboBox)itemContainer).SelectedIndex = 0;
    }
}

May I ask - is there a better resource you would recommend to me than the forums and the release notes to keep up to date on these types of changes?  Where will you be making the changes to support documentation?

Again, thanks for the quick response.

-Thad

0
Simon
Telerik team
answered on 18 Jul 2011, 12:19 PM
Hello Thad,

Such changes are announced first in the release notes then in the forums and finally in the related support resources - demos and help. Unfortunately we did not manage to announce this particular change on time, so please excuse us for the omission We will fix that soon.

Regarding where we will be making the change in the documentation, we are planning of revamping the help of RadComboBox and adding/updating certain topics. So, in the end this change will be described there as well.

I hope this information helps. If you have other questions, please let me know.

Greetings,
Simon
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Asked by
Thad
Top achievements
Rank 2
Answers by
Simon
Telerik team
Thad
Top achievements
Rank 2
Share this question
or