See the example below;
This is an application webforms
, but you only need to understand the class part and what you have within the method Page_Load
.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
var addlista = new List<PropostaAgente>();
var lista1 = new PropostaAgente()
{
Campo1 = "Campo1",
Campo2 = "Campo2",
};
addlista.Add(lista1);
var Promotora = new LojaPromotoraInfo
{
CodGerente = "CodGerente",
CodLojaPromotora = "CodLojaPromotora",
Agente = addlista,
};
var teste = Promotora;
}
}
public class LojaPromotoraInfo
{
public List<PropostaAgente> Agente { get; internal set; }
public string CodGerente { get; internal set; }
public string CodLojaPromotora { get; internal set; }
}
public class PropostaAgente
{
public string Campo1 { get; internal set; }
public string Campo2 { get; internal set; }
}
}
You can change the addlista
by a method that returns that list or only tells the list if you already have it.
your objects Codmanager and Codlojapromotora are being filled correctly? , Which programming language are you using?
– Marco Souza
Yes they are being filled out correctly. I am using C#
– SirSmart
Okay, you have a class called Propostaagente, does this class already have her data? if not in place of you do the new call a method that returns that class with your data.
– Marco Souza