Jul 16, 2012, 3:41 PM
Combobox - Change of behavior
Hi,
Am attempting to upgrade our project to 2.0 RC2. When calling SetValue on a combobox (linked to a store) from codebehind we are getting a change in behaviour from 1.x.
The old behaviour was that the record in the store was selected and the displayfield was shown. The new behaviour is that the value set in SetValue function is being shown.
Can you tell me is this by design and if so how do I replicate the old behaviour. Code below for testing
thanks
Dermot
Am attempting to upgrade our project to 2.0 RC2. When calling SetValue on a combobox (linked to a store) from codebehind we are getting a change in behaviour from 1.x.
The old behaviour was that the record in the store was selected and the displayfield was shown. The new behaviour is that the value set in SetValue function is being shown.
Can you tell me is this by design and if so how do I replicate the old behaviour. Code below for testing
thanks
Dermot
<%@ Page Language="C#" AutoEventWireup="true" %>
<!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">
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
storeCbb.DataSource = new object[]
{
new object[] { 0, "John" },
new object[] { 1, "Dermot" }
};
storeCbb.DataBind();
}
protected void btTest_Click(object sender, DirectEventArgs e)
{
cbb.SetValue("0");
}
protected void btTest2_Click(object sender, DirectEventArgs e)
{
cbb.SetValue("1");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button runat="server" ID="btnTest" Text="SetValue 0">
<DirectEvents><Click OnEvent="btTest_Click"></Click></DirectEvents>
</ext:Button>
<ext:Button runat="server" ID="Button1" Text="SetValue 1">
<DirectEvents><Click OnEvent="btTest2_Click"></Click></DirectEvents>
</ext:Button>
<ext:ComboBox ID="cbb" runat="server" Editable="false" FieldLabel="Name" AnchorHorizontal="100%" DisplayField="Name" ValueField="Id">
<Store>
<ext:Store ID="storeCbb" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Id" Type="Int" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</div>
</form>
</body>
</html>