store charge from a list object

  1. #1

    [SOLVED] store charge from a list object

    hi

    need, carry a store in a combobox from the object list,

    the object was previously loaded from a DataReader,

    but the need to include an item "null", need to load the list and then the store.

           
     public void SecCod_carregadados(object sender, StoreRefreshDataEventArgs e){
                
                cnxSecCod.abrirConexao();
                cnxSecCod.comandos = new MySqlCommand("SELECT SecCod, SecDes FROM SECAO WHERE DEPCOD = @DEPCOD", cnxSecCod.conn);
                cnxSecCod.comandos.Parameters.Add("@DEPCOD", DepCod.Value);
                cnxSecCod.drlistagem = cnxSecCod.comandos.ExecuteReader();
    
                List<object> listaseccod;
    
                while (cnxSecCod.drlistagem.Read())
                {
                    listaseccod = new List<object>
                    {
                        new {SecCod = int.Parse(cnxSecCod.drlistagem["SecCod"].ToString()), SecDes = cnxSecCod.drlistagem["SecDes"].ToString()}
                    };
    
                    if (cnxSecCod.drlistagem.Read() == false) {
                        SecaoStore.DataSource = listaseccod;
                        SecaoStore.DataBind();                
                    }
                }
                cnxSecCod.fecharConexao();
    Last edited by danilo; Jul 08, 2011 at 4:03 AM.
  2. #2
    hi guys!

    coincidentally, this example could study the solution to my question

    page: https://examples1.ext.net/#/GridPane...h_Remote_Data/

            public void SecCod_carregadados(object sender, StoreRefreshDataEventArgs e){
                //26/06/2011 Danilo - Carrega Dados de Seção
                cnxSecCod.abrirConexao();
                cnxSecCod.comandos = new MySqlCommand("SELECT SecCod, SecDes FROM SECAO WHERE DEPCOD = @DEPCOD", cnxSecCod.conn);
                cnxSecCod.comandos.Parameters.Add("@DEPCOD", DepCod.Value);
                cnxSecCod.drlistagem = cnxSecCod.comandos.ExecuteReader();
    
                List<object> listaseccod = new List<object>();
                listaseccod.Add(new { SecCod = 0, SecDes = "(Nenhum)"});
                while (cnxSecCod.drlistagem.Read())
                {
                    listaseccod.Add(new { SecCod = int.Parse(cnxSecCod.drlistagem["SecCod"].ToString()), SecDes = cnxSecCod.drlistagem["SecDes"].ToString() });
                }
    
                SecaoStore.DataSource = listaseccod;
                SecaoStore.DataBind();
                cnxSecCod.fecharConexao();
            }

Similar Threads

  1. fill my store from a list of object.
    By DEV_EXT_TN in forum 2.x Help
    Replies: 0
    Last Post: Aug 01, 2012, 11:54 AM
  2. How to change List<object> to SqlDataSource
    By Aod47 in forum 1.x Help
    Replies: 0
    Last Post: May 25, 2012, 2:16 AM
  3. Replies: 0
    Last Post: Oct 21, 2011, 3:04 AM
  4. List Collections Object with Dataview
    By CoolNoob in forum 1.x Help
    Replies: 4
    Last Post: Dec 18, 2009, 3:00 AM
  5. [CLOSED] Binding List(of Object) Parsing properties
    By CMA in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 24, 2009, 7:25 AM

Posting Permissions