Oct 23, 2012, 8:33 AM
Combobox SelectedItems by value icw store
Hi,
When I fill a combobox with items by using a store (no inner items), and try to select an item by value, it does not work, no item is selected.
When I try the index instead of value for the SelectedItems, it is working.
Thanks for any help,
Sander
When I fill a combobox with items by using a store (no inner items), and try to select an item by value, it does not work, no item is selected.
When I try the index instead of value for the SelectedItems, it is working.
Thanks for any help,
Sander
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Linq" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
</style>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
List<object> list = new List<object>
{
new {Text = "Text3", Value = 3},
new {Text = "Text4", Value = 4},
new {Text = "Text5", Value = 5}
};
this.Store1.DataSource = list;
this.Store1.DataBind();
this.ComboBox1.SelectedItems.Add(new Ext.Net.ListItem { Value = "4" });
}
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" AjaxViewStateMode="Enabled">
</ext:ResourceManager>
<form id="form2" runat="server">
<ext:FormPanel runat="server" ID="MainPanel" Title="test..." Height="200">
<Items>
<ext:ComboBox
ID="ComboBox1"
runat="server"
DisplayField="Text"
ValueField="Value"
QueryMode="Local">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Value">
<Fields>
<ext:ModelField Name="Text" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</Items>
</ext:FormPanel>
</form>
</body>
</html>