[CLOSED] Combobox with store and pageproxy

  1. #1

    [CLOSED] Combobox with store and pageproxy

    I has a combobox configured like this:
    <ext:ComboBox ID="cbCitizen" runat="server" DisplayField="FullName" ValueField="ID_Citizen"
                                    TypeAhead="false" LoadingText="Searching..." Width="500" FieldLabel="Citizen"
                                    PageSize="10" HideTrigger="true" MinChars="3" ItemSelector="div.search-item">
                                        <ext:FieldTrigger Icon="Clear" Qtip="Remove selected" />
                                        <TriggerClick Handler="this.removeByValue(this.getValue());this.clearValue();" />
                                        <ext:Store ID="stCitizenearch" runat="server" AutoLoad="false" OnRefreshData="stCitizenSearcher_RefreshData">
                                                        <ext:RecordField Name="ID_Citizen" Type="Int" />
                                                        <ext:RecordField Name="Name" Type="String" />
                                                        <ext:RecordField Name="Surname" Type="String" />
                                                        <ext:RecordField Name="CodFiscale" Type="String" />
                                                        <ext:RecordField Name="NTesseraSanitaria" Type="String" />
                                                        <ext:RecordField Name="FullName" Type="String" />
                                    <Template ID="Template1" runat="server">
                                            <tpl for=".">
                              <div class="search-item">
                                 Tessera sanitaria: {NTesseraSanitaria}
    During the search I have no problem, but when I try to set a selected item when combo is empty the combo display only a value of item that I try to add.
    My code to select an item is
    Example 1:
    cbCitizen.SelectedItem.Value = 1;
    cbCitizen.SelectedItem.Text = "John Writers"
    Example 2:
     cbCitizen.Items.Add(new Ext.Net.ListItem("John Writers", 1));
    After this test the results is the same. he text is always = 1

    Thanks for support
    Last edited by Daniil; Apr 25, 2011 at 8:00 AM. Reason: [CLOSED]
  2. #2

    1. This code causes compiler erros:
    cbCitizen.SelectedItem.Value = 1;
    cbCitizen.Items.Add(new Ext.Net.ListItem("John Writers", 1));
    because expected type is string, not int.

    2. Adding in Items collection doesn't make any sense during DirectEvent. Please use .AddRecord();

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            if (!X.IsAjaxRequest)
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" }
        protected void Add(object sender, DirectEventArgs e)
            this.ComboBox1.GetStore().AddRecord(new { value = "3", text = "item3"  });
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:ComboBox ID="ComboBox1" runat="server">
                <ext:Store runat="server">
                                <ext:RecordField Name="value" />
                                <ext:RecordField Name="text" />
        <ext:Button runat="server" Text="Add" OnDirectClick="Add" />

Similar Threads

  1. Replies: 14
    Last Post: Nov 16, 2012, 10:01 AM
  2. TabPanel and Store with PageProxy?
    By dmoore in forum 1.x Help
    Replies: 4
    Last Post: Aug 25, 2011, 3:40 PM
  3. [CLOSED] PageProxy
    By jeybonnet in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 21, 2011, 3:26 PM
  4. Multi Store PageProxy
    By andreydruz in forum 1.x Help
    Replies: 1
    Last Post: Jan 08, 2011, 12:28 PM
  5. [CLOSED] Timeout for PageProxy
    By macap in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 07, 2010, 1:20 PM

Posting Permissions