Can't get a ComboBox to bind to a SqlDataSource

  1. #1

    Can't get a ComboBox to bind to a SqlDataSource

    Hi guys, I'm trying to bind a very simple ComboBox to a SqlDataSource but it is not working, it doesn't render the ComboBox and corrupts the other controls on the page, can you please take a look at my sample code?
    Thank you

    <asp:SqlDataSource ID="getCSR" runat="server" ConnectionString="..." SelectCommand="SELECT ID, Display FROM CSR ORDER BY Display" ProviderName="System.Data.SqlClient">
    </asp:SqlDataSource>
    
    <ext:Store ID="StoreCSR" runat="server" DataSourceID="getCSR">
            <Reader>
                            <ext:JsonReader IDProperty="ID">
                                <Fields>
                                    <ext:RecordField Name="ID" />
                                    <ext:RecordField Name="Display" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
    </ext:Store>
    
     <ext:ComboBox ID="ComboBox1" runat="server" StoreID="StoreCSR" 
            DisplayField="Display" ValueField="ID">
        </ext:ComboBox>
  2. #2
    Hi Paul

    Place AutoDataBind="true" in your combobox and see if it makes a diffirence

    Richardt
  3. #3
    Quote Originally Posted by Richardt View Post
    Hi Paul

    Place AutoDataBind="true" in your combobox and see if it makes a diffirence

    Richardt
    Hi Richard, I did that but nothing changed, the control doesn't get rendered, if I remove the StoreID it renders fine, the SqlDataSource has been tested with a GridView and the query is fine, I can't seem to find the problem, I'm testing on a clean and new aspx file, by using FireBug I inspected the placeholder where the ComboBox should be and this is the content:

    <div style="display: inline;" id="ComboBox1_Container">
    
    </div>
  4. #4
    Fixed, the <ext:Store> must be placed on the aspx file before the <ext:ComboBox> that is bound to it otherwise it won't render.
    Case closed.

    Thanks Richardt.

Similar Threads

  1. [CLOSED] How to bind a ComboBox RecordField in runtime?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 16, 2012, 12:50 PM
  2. [CLOSED] How to "bind" a ComboBox to a field in a FormPanel
    By mattwoberts in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Jan 11, 2011, 10:22 AM
  3. Bind the combobox dynamically
    By Prasad in forum 1.x Help
    Replies: 1
    Last Post: Aug 19, 2010, 8:49 PM
  4. [CLOSED] Hidden Fields, SqlDataSource, ComboBox Update Grid Problem
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2010, 4:06 PM
  5. ComboBox with SqlDataSource
    By gargamel4670 in forum 1.x Help
    Replies: 10
    Last Post: Mar 04, 2009, 4:02 PM

Posting Permissions