Nov 29, 2017, 5:18 PM
[CLOSED] Combobox inside Menu
Hello,
I have a button, when I click it, it opens a menu which contains a combobox. What I'm trying to do is getting the combobox value when I change its value, but it always returns null.
I have created a demo:
Here is my Carrito_repre2.aspx file:
I forgot to mention that I have tried to do the same without placing the combobox inside a menu and it worked perfect.
I have a button, when I click it, it opens a menu which contains a combobox. What I'm trying to do is getting the combobox value when I change its value, but it always returns null.
I have created a demo:
Here is my Carrito_repre2.aspx file:
<%@ Page Title="Extranet Jhayber" Language="C#"
CodeBehind="Carrito_repre2.aspx.cs" Inherits="Extranet.Carrito_repre2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Xml" %>
<html>
<head runat="server">
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button ID="Button1"
MarginSpec = "0 0 0 500"
MinWidth="10"
runat="server"
MenuAlign="tr-br"
Text="menu">
<Menu>
<ext:Menu runat="server" ID="menucliente">
<Items>
<ext:Panel runat="server" Width="400" Height="100">
<Items>
<ext:ComboBox ID="ComboClientes1" runat="server" TypeAhead="true" EnableRegEx="true" MarginSpec="10 10 0 20"
Mode="Local" EmptyText="Selecciona un valor..." LabelWidth="60" LabelAlign="Left" SelectOnFocus="true" FieldLabel="combo1:" DisplayField="Name"
ValueField="Name" HiddenName="Name" ColumnWidth="0.9" Frame="true" AutoSelect="true" AutoShow="true" padding="5" Width="355">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<DirectEvents>
<Change OnEvent="getcombo"></Change>
</DirectEvents>
</ext:ComboBox>
</Items>
</ext:Panel>
</Items>
</ext:Menu>
</Menu>
</ext:Button>
</form>
</body>
</html>
And here is my Carrito_repre2.aspx.cs file:using System;
using System.Collections.Generic;
using Ext.Net;
namespace Extranet
{
public partial class Carrito_repre2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Store1.DataSource = values;
Store1.DataBind();
}
public List<object> values
{
get
{
return new List<object>
{
new { Name = "1" },
new { Name = "2" },
new { Name = "3" },
new { Name = "4" },
new { Name = "5 "}
};
}
}
public void getcombo (object sender, DirectEventArgs e)
{
string combovalue = ComboClientes1.SelectedItem.Value;
}
}
}
I want to get the combo value, but in line 32 combovalue is always null.I forgot to mention that I have tried to do the same without placing the combobox inside a menu and it worked perfect.
Last edited by fabricio.murta; Dec 01, 2017 at 6:04 PM.