Nov 25, 2013, 9:03 PM
[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]