ComboBox data binding

  1. #1

    ComboBox data binding

    protected void Page_Init(object sender, EventArgs e)
            {
                taxingTypeStore.DataSource = GetTaxingTypes(); //returns Dictionary<int, string> which has values
                this.taxingTypeStore.DataBind();
    }
    
     <div>
                            <b>Taxing Type</b>
                            <ext:ComboBox ID="ddlTaxingType" runat="server" StoreID="taxingTypeStore" ValueField="Key" DisplayField="Value" />
                            <ext:Store ID="taxingTypeStore" runat="server">
                                <Reader>
                                    <ext:JsonReader IDProperty="Key">
                                        <Fields>
                                            <ext:RecordField Name="Key" />
                                            <ext:RecordField Name="Value" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
      </div>
    I wonder why the data doesn't show. But taxingTypeStore has the data!
    Click image for larger version. 

Name:	Untitled.png 
Views:	86 
Size:	11.6 KB 
ID:	3089
  2. #2
    Store doesn't support Dictionary for binding
  3. #3
    Which data types does the Store support? Does it support List<Tuple<int, string>>?
    Last edited by AlexMaslakov; Aug 18, 2011 at 1:38 PM.
  4. #4
    Hi,

    I have similar problem:

    I have a combobox in a user control and i populate the combobox from database. But when i add the line

    cmbbxStore.DataBind();
    it just stucks. Nothing happens.

    My code is:

    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
                Populate();
        }
    
        protected void Populate()
        {
            cmbbxStore.DataSource = // A DataTable with fields (ID, Name)
            cmbbxStore.DataBind();
        }
    </script>
    
    <ext:ComboBox runat="server" FieldLabel="Program" ValueField="ID" DisplayField="Name" QueryMode="Local">
        <Store>
            <ext:Store runat="server" ID="cmbbxStore">
                <Model>
                    <ext:Model runat="server" ID="storeModel" IDProperty="ID">
                        <Fields>
                            <ext:ModelField Name="ID" />
                            <ext:ModelField Name="Name" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
    </ext:ComboBox>
    When i remove the DataBind(), my combobox shows 10 items like this : {Name}. Here, "10" is the number of records in my lookup table.


    Where is my problem, please?

    Thank you.
    Last edited by extneter; Jun 13, 2013 at 9:06 AM.

Similar Threads

  1. Data not binding into ComboBox
    By nagesh in forum 1.x Help
    Replies: 5
    Last Post: Jul 12, 2012, 2:35 PM
  2. [CLOSED] ComboBox in user control binding but not showing data
    By Digital.Dynamics in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: May 08, 2012, 12:09 PM
  3. [CLOSED] Data binding to NetTiers data entity objects
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 09, 2012, 3:35 PM
  4. [CLOSED] Combobox Data Binding Problem
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 09, 2011, 1:55 PM
  5. Combobox not binding data
    By Satyanarayana murthy in forum Open Discussions
    Replies: 0
    Last Post: Jun 27, 2009, 12:22 PM

Posting Permissions