[FIXED] [#922] [3.3] ComboBox SelectedItem problem

  1. #1

    [FIXED] [#922] [3.3] ComboBox SelectedItem problem

    I got some problems using the ComboBox Controls.
    For some reason the SelectedItem.Value property is null only for some items in the combobox.
    For other selected items everything works. I don't get it why this happens.

    The ComboBox is defined as followed:
            <ext:ComboBox ID="CancelPeriodType" runat="server" Disabled="false"
                    <ext:Store runat="server" ModelName="EnumModel"/>
    using this model
            <ext:Model runat="server" Name="EnumModel">
                    <ext:ModelField Name="Key" />
                    <ext:ModelField Name="Value" />
    It is filled in the page_load with this line:
    this.CancelPeriodType.GetStore().DataSource = this.GetEnumTranslation<BasContractCancelPeriodType>();
    which basicly creates an IList<KeyValuePair<T, string>> with the EnumValue as key and the translated String as value.

    It looks like the data is submitted correctly:
    is either
    which gives SelectedItem.Value = null.

    works and gives SelectedItem.Value = "Weeks".

    Please help me asap, as I'm messing around with this issue for days now!
    Last edited by Daniil; Oct 16, 2015 at 10:17 AM. Reason: [FIXED] [#922] [3.3]
  2. #2
    Hi @anwichmann,

    I don't quite have any ideas what might go wrong. Could you, please, provide a full test case to reproduce the issue?
  3. #3
    Sorry, but I couldn't reproduce it with a copy and paste version.
    Last edited by anwichmann; Oct 14, 2015 at 10:41 PM.
  4. #4
    Ok, I think I finally found the answer.

    It looks like the EmptyText is causing the problem.
    If the EmptyText equals the Text of an Item in the combobox the SelectedItem is not set correctly if the an Item with this text is selected.

    This is definitely a bug and needs to be fixed.
  5. #5
    Thank you for pointing that out.

    Created an Issue:

    I am investigating a possible solution.

    Here is a test case.

    1. Select the second item
    2. Click the Submit button
    3. SelectedItem.Value is empty

    <%@ Page Language="C#" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            if (!X.IsAjaxRequest)
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                    new object[] { "1", "Item 1" },
                    new object[] { "2", "Item 2" },
                    new object[] { "3", "Item 3" }
        protected void Submit(object sender, DirectEventArgs e)
            X.Msg.Alert("Submit", this.ComboBox1.SelectedItem.Value).Show();
    <!DOCTYPE html>
    <head runat="server">
        <title>Ext.NET v3 Example</title>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button runat="server" Text="Submit" OnDirectClick="Submit" />
                EmptyText="Item 2">
                    <ext:Store runat="server">
                            <ext:Model runat="server">
                                    <ext:ModelField Name="value" />
                                    <ext:ModelField Name="text" />
                            <ext:ArrayReader />
  6. #6
    It has been fixed in the SVN trunk revision #6601. It goes to the 3.3 release.
  7. #7
    Thanks for the quick fix.

Similar Threads

  1. [CLOSED] Problem with Combobox.SelectedItem
    By dataworks in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 25, 2015, 11:04 AM
  2. Replies: 10
    Last Post: May 16, 2014, 4:39 AM
  3. [CLOSED] [2.2] Combobox selecteditem problem
    By John_Writers in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 09, 2013, 12:51 PM
  4. [CLOSED] Problem with selectedItem.value in combobox
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 10, 2012, 4:35 PM
  5. ComboBox SelectedItem according to Value problem
    By juredecman in forum 1.x Help
    Replies: 0
    Last Post: Aug 25, 2010, 8:57 PM

Tags for this Thread

Posting Permissions