how to display data from a DataSet or DataReader into a combobox

Page 1 of 2 12 LastLast
  1. #1

    how to display data from a DataSet or DataReader into a combobox

    hi


    i want to display values form a DataSet in a combo box but dnt know how.....if anyone have any idea plz do share..... realy need to know.


    thank u
  2. #2

    RE: how to display data from a DataSet or DataReader into a combobox


    Hi,

    you can get the info in this example

    
    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
            {
                StoreCombo.DataSource = Department.GetAll();
                StoreCombo.DataBind();
            }
    <script>
    
    <ext:Store ID="StoreCombo" runat="server">
                
    <Reader>
           <ext:JsonReader ReaderID="ID">
                  <Fields>
                   <ext:RecordField Name="ID" />
                   <ext:RecordField Name="Name" />
                   </Fields>
           </ext:JsonReader>
    </Reader>
    </ext:Store>
    
    <ext:ComboBox ID="cbDepartment" runat="server" TriggerAction="All" ForceSelection="true"
    StoreID="StoreCombo" DisplayField="Name" ValueField="ID">
    </ext:ComboBox>
  3. #3

    RE: how to display data from a DataSet or DataReader into a combobox

    1. Mirror the dataset to a store in front end. either JsonReader ArrayReader or XmlReader is ok

    2. set the StoreID property of the comboBox to the ID of that store.
  4. #4

    RE: how to display data from a DataSet or DataReader into a combobox

    can u explain me "Mirror the dataset to a store in front end with either JsonReader " with some example................i dont understand how?
  5. #5

    RE: how to display data from a DataSet or DataReader into a combobox

    Like I typed out in the exaple above...
  6. #6

    RE: how to display data from a DataSet or DataReader into a combobox

    is that i just have to assigne Dataset to the store Datasource for that example in Page_Load method?????
  7. #7

    RE: how to display data from a DataSet or DataReader into a combobox


    yes,

    in this case its a data access class but it can also be a objectdatasource or other datasource, when you look at the examples of grid's with datasources everything wil be clear.

    Or in your ASP page itself




    <asp:objectdatasource id="MyDataSource" runat="server" selectmethod="GetData" />




    <ext:Store ID="Store" runat="server" DataSourceID="MytDataSource" >

    :)
  8. #8

    RE: how to display data from a DataSet or DataReader into a combobox

    hi thanx for reply

    i have done like this

    
    <asp:ObjectDataSource ID="source1" runat="server" SelectMethod="getListBAL" TypeName="MailCourierBAL.ListControllerBAL" />
    where getListBAL is a function in my MailCourierBAL.ListControllerBAL class that returns a DataSet

    
    <ext:Store ID="ListStore" runat="server" DataSourceID="source1">
    <Reader>
       <ext:JsonReader>
       <Fields>
       <ext:RecordField Name="listName">
       </ext:RecordField>
       </Fields>
       </ext:JsonReader>
    </Reader>
    </ext:Store>
    and combo

    
    <ext:ComboBox ID="ListCombo" runat="server" StoreID="ListStore" Editable="true" AllowBlank="false"
                             DisplayField="listName"
                             ValueField="listName"
                             Mode="Local"                         
                             TriggerAction="All">                         
                            </ext:ComboBox>
    but its not showing values....
  9. #9

    RE: how to display data from a DataSet or DataReader into a combobox

    i realy need that plz help


    one thing more about the problem....... if i click on the combo and move mouse on the drop down it highlights for three values if i have three in the column i fetch in DataSet n two if i have two in DataSet.....but not showing them.
  10. #10

    RE: how to display data from a DataSet or DataReader into a combobox



    If your page is loaded look at your html source to see if te store is populated. Then use these settings for your combobox


    <ext:ComboBox ID="ComboBox" StoreID="ListStore" runat="server"
                DisplayField="ListName"     
                ValueField="ListName"  Mode="Local" AutoPostBackEvent="Select" 
                TriggerAction="All"> 
    </ext:ComboBox>
    This works for me so has to do the thing for U to
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Feb 21, 2012, 8:13 AM
  2. Replies: 0
    Last Post: Sep 08, 2011, 1:16 PM
  3. Conditional data display
    By huzzy143 in forum 1.x Help
    Replies: 10
    Last Post: Aug 26, 2011, 3:14 PM
  4. Replies: 3
    Last Post: Mar 01, 2010, 10:27 AM
  5. Replies: 6
    Last Post: Dec 20, 2008, 4:35 AM

Posting Permissions