View Full Version : [CLOSED] Problem with Combobox.SelectedItem

May 22, 2015, 3:47 PM
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";

May 25, 2015, 11:04 AM

During DirectEvent/DirectMethod you have to use `SetValue` method


or call `UpdateSelectedItems` method after changing of SelectedItem(s)

cmbCDDTabID.SelectedItem.Value = "100";