Originally Posted by
michaeld
I noted elsewhere that option triggers select.
SelectedItems should not fire the Select event. I cannot reproduce. I tried with ComboBoxes with Items and a Store with Proxy.
Example
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Store_ReadData(object sender, EventArgs e)
{
Store store = sender as Store;
store.DataSource = new object[]
{
new object[] { "1", "Item 1" },
new object[] { "2", "Item 2" },
new object[] { "3", "Item 3" }
};
System.Threading.Thread.Sleep(3000);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:ComboBox runat="server">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
</Items>
<SelectedItems>
<ext:ListItem Value="1" />
</SelectedItems>
<Listeners>
<Select Handler="console.log('Select');" />
</Listeners>
</ext:ComboBox>
<ext:ComboBox runat="server" DisplayField="text" ValueField="value">
<Store>
<ext:Store runat="server" OnReadData="Store_ReadData">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="value" />
<ext:ModelField Name="text" />
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:PageProxy>
<Reader>
<ext:ArrayReader />
</Reader>
</ext:PageProxy>
</Proxy>
</ext:Store>
</Store>
<SelectedItems>
<ext:ListItem Value="1" />
</SelectedItems>
<Listeners>
<Select Handler="console.log('Select');" />
</Listeners>
</ext:ComboBox>
</form>
</body>
</html>
Originally Posted by
michaeld
All I can do is note the trouble with setting Value since it caused an obvious exception which I thought you might want to rectify if dev solution exists.
This exception is caused by the markup parser. A ComboBox's Value is "object" type. So, the parser somehow cannot create an object from a string representation. I was always curious why. However, I doubt we can get rid of that exception. Do you have a solution?
Anyway, if needed you could set up it in code behind or this way:
<ext:ComboBox runat="server" Value='<%# "1" %>' AutoDataBind="true">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
</Items>
<Listeners>
<Select Handler="console.log('Select');" />
</Listeners>
</ext:ComboBox>
Originally Posted by
michaeld
I also seem to remember a thread on discussing supporting Value.
Seems it was a bit different discussion. As for the current problem, the Value is actually supported.