[CLOSED] Get Store and Deserialize

  1. #1

    [CLOSED] Get Store and Deserialize

    Hi How can I do to get the store from click button with ExtraParams and deserialize, this is my example:

            <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
            <ext:Store ID="Store1" runat="server">
                <Model>
                    <ext:Model ID="Model1" runat="server">
                        <Fields>
                            <ext:ModelField Name="Id" Type="Int" />
                            <ext:ModelField Name="Nombre" Type="String" />
                            <ext:ModelField Name="Marca" Type="String" />
                            <ext:ModelField Name="Cantidad" Type="Int" />
                            <ext:ModelField Name="UnidadMedida" Type="String" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            <ext:Button ID="Button1" runat="server" Text="Submit">
                <DirectEvents>
                    <Click OnEvent="Button1_Click">
                        <ExtraParams>
                            <ext:Parameter Name="Registros" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
            protected void Page_Load(object sender, EventArgs e)
            {
                for (int i = 0; i < 5; i++)
                {
                    Alimento temp = new Alimento();
                    temp.Id = i;
                    temp.Nombre = "Nombre" + i;
                    temp.Marca = "Marca" + i;
                    temp.Cantidad = 10 + i;
                    temp.UnidadMedida = "kg";
    
                    Store1.Add(new { Id = temp.Id, Nombre = temp.Nombre, Marca = temp.Marca, Cantidad = temp.Cantidad, UnidadMedida = temp.UnidadMedida });
                }
            }
    
            protected void Button1_Click(object sender, DirectEventArgs e)
            {
                //List<Alimento> lAliemnto = e.Parameters["Registros"];
            }
    
            public class Alimento
            {
                int id;
                string nombre;
                string marca;
                int cantidad;
                string unidadmedida;
    
                public int Id
                {
                    get { return id; }
                    set { id = value; }
                }
    
                public string Nombre
                {
                    get { return nombre; }
                    set { nombre = value; }
                }
    
                public string Marca
                {
                    get { return marca; }
                    set { marca = value; }
                }
    
                public int Cantidad
                {
                    get { return cantidad; }
                    set { cantidad = value; }
                }
    
                public string UnidadMedida
                {
                    get { return unidadmedida; }
                    set { unidadmedida = value; }
                }
            }
    Last edited by Daniil; Nov 29, 2013 at 2:21 PM. Reason: [CLOSED]
  2. #2
    Hello!

    It should be similar to this:

    <ext:Button ID="Button1" runat="server" Text="Submit">
        <DirectEvents>
            <Click OnEvent="Button1_Click">
                <ExtraParams>
                    <ext:Parameter Name="Registros" Value="#{Store1}.getRecordsValues()" Mode="Raw" Encode="true" />
                </ExtraParams>
            </Click>
        </DirectEvents>
    </ext:Button>
    protected void ButtonClick(object sender, DirectEventArgs e)
    {
        List<Alimento> persons = new StoreDataHandler(e.ExtraParams["data"]).ObjectData<Alimento>();
    }
    Last edited by Daniil; Nov 26, 2013 at 4:15 AM.

Similar Threads

  1. [CLOSED] how to Deserialize the #{store_role}.getChangedData()
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2013, 3:29 PM
  2. [CLOSED] Deserialize problem
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 11, 2013, 3:54 PM
  3. Replies: 1
    Last Post: Jan 12, 2013, 4:47 AM
  4. [CLOSED] JSON.Deserialize Lastes SVN
    By egodoy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 21, 2010, 5:59 PM
  5. [CLOSED] [1.0] Ext.encode and JSON.Deserialize
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 14, 2010, 8:03 AM

Tags for this Thread

Posting Permissions