[CLOSED] Problem with Combobox.SelectedItem

  1. #1

    [CLOSED] Problem with Combobox.SelectedItem

    We are having a recurring issue with setting combobox values in our projects. Every now and then we will get different behaviour from setting the selected item by using ComboBox.SelectedItem.Value. Sometimes ComboBox.SelectedItem.Value = "100" works, sometimes it doesn't. Sometimes ComboBox.SetValue("100") works, sometimes it doesn't. Test case below.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="com.bspr.crbspr.pages.WebForm1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">
            <ext:ResourceManager ID="rsmMain" runat="server" Theme="Gray">
            <ext:Viewport ID="vwpMain" runat="server">
                    <ext:ComboBox runat="server" ID="cmbCDDTabID" FieldLabel="CDD Tab ID" ValueField="CDD_TAB_ID" DisplayField="CDD_TAB_DESC" AnchorHorizontal="99%" AllowBlank="false">
                            <ext:Store ID="Store1" runat="server" IgnoreExtraFields="false">
                                    <ext:Model ID="Model1" runat="Server">
                                            <ext:ModelField Name="CDD_TAB_ID" />
                                            <ext:ModelField Name="CDD_TAB_DESC" />
                    <ext:Button runat="server" ID="txtTest" Text="TEST">
                            <Click Handler="App.direct.test();"></Click>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    namespace com.bspr.crbspr.pages
        public partial class WebForm1 : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)
                cmbCDDTabID.Store[0].DataSource = new object[] 
                    new object[] { "0", "none" },
                    new object[] { "100", "item1" },
                    new object[] { "200", "item2" },
                    new object[] { "300", "item3" }
                cmbCDDTabID.SelectedItem.Index = 0;
            public void test()
                cmbCDDTabID.SelectedItem.Value = "100";
    Last edited by Daniil; Jun 08, 2015 at 10:20 AM. Reason: [CLOSED]
  2. #2

    During DirectEvent/DirectMethod you have to use `SetValue` method
    or call `UpdateSelectedItems` method after changing of SelectedItem(s)
    cmbCDDTabID.SelectedItem.Value = "100";

Similar Threads

  1. Replies: 10
    Last Post: May 16, 2014, 4:39 AM
  2. [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
  3. [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
  4. [CLOSED] Problem to show SelectedItem in Combobox v2.0
    By Oliver in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 28, 2012, 3:56 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

Posting Permissions