Jun 11, 2013, 3:23 PM
[CLOSED] combobox inside a menu and directevent
Hello
I think this is a bug unless it is supposed to work so, in that case I still need a solution.
I have a combox inside a menu (of a button) and when the selection changes the selected item is null. This is not the case if it is outside the menu. See example:
I think this is a bug unless it is supposed to work so, in that case I still need a solution.
I have a combox inside a menu (of a button) and when the selection changes the selected item is null. This is not the case if it is outside the menu. See example:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Store1.DataSource = new object[]
{
new object[] { "AL", "Alabama", "The Heart of Dixie" },
new object[] { "AK", "Alaska", "The Land of the Midnight Sun" },
new object[] { "AZ", "Arizona", "The Grand Canyon State" },
new object[] { "AR", "Arkansas", "The Natural State" },
new object[] { "WY", "Wyoming", "Like No Place on Earth"}
};
Store1.DataBind();
}
protected void ComboChanged(object sender, DirectEventArgs e)
{
ComboBox cmbo = sender as ComboBox;
var text = "";
if (cmbo != null)
{
text = cmbo.SelectedItem.Value != null ? cmbo.SelectedItem.Value : "null";
}
else
{
text = "sender object should be of type combobox";
}
InfoLabel.Text = text;
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>SelectBox - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="abbr" />
<ext:ModelField Name="state" />
<ext:ModelField Name="nick" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:Label ID="InfoLabel" runat="server" Text="select something and you'll see the selected value here">
</ext:Label>
<ext:ComboBox runat="server" ID="CmboProfileList" DisplayField="state" ValueField="abbr"
Mode="Local" StoreID="Store1">
<DirectEvents>
<Select OnEvent="ComboChanged" />
</DirectEvents>
</ext:ComboBox>
<ext:Button runat="server" Text="Button with Menu">
<Menu>
<ext:Menu ID="Menu2" runat="server">
<Items>
<ext:ComboBox runat="server" ID="ComboBox1" DisplayField="state" ValueField="abbr"
Mode="Local" StoreID="Store1">
<DirectEvents>
<Select OnEvent="ComboChanged" />
</DirectEvents>
</ext:ComboBox>
<ext:Label Text="item2" />
<ext:Label Text="item3" />
</Items>
</ext:Menu>
</Menu>
</ext:Button>
</form>
</body>
</html>
Last edited by Daniil; Jun 12, 2013 at 8:43 AM.
Reason: [CLOSED]