Fórum Dúvida com array ou lista #456715
26/09/2013
0
string[] testaGrid = new string[15];
testaGrid[0] = "";
testaGrid[1] = ("407630448");
testaGrid[2] = ("40301630");
testaGrid[3] = ("Creatinina");
testaGrid[4] = ("1");
testaGrid[5] = ("Tabela Própria");
testaGrid[6] = ("");
testaGrid[7] = ("07/05/2013");
testaGrid[8] = ("Glosado Parcial");
testaGrid[9] = ("3,90");
testaGrid[10] = ("3,75");
testaGrid[11] = ("0,15");
testaGrid[12] = ("0,10");
testaGrid[13] = ("2564789-A00-016");
testaGrid[14] = ("");
gvItemNotaFiscal.DataSource = testaGrid;
gvItemNotaFiscal.DataBind();
Pjava
Curtir tópico
+ 0Posts
26/09/2013
Joel Rodrigues
new {
Nome = "PJava",
Codigo = "123"
Etc = "etc"
}
Gostei + 0
26/09/2013
Pjava
Gostei + 0
26/09/2013
Joel Rodrigues
Gostei + 0
26/09/2013
Pjava
string[] marray = new string[15]{nome="pjava",etc="etc"}; Assim dá erro comigo, tipo, Nome não está no atual contexto e etc....
Gostei + 0
26/09/2013
Joel Rodrigues
Você vai criar um array de Object OU uma List<Object>, onde CADA ITEM vai ser um objeto dinâmico.
Para facilitar, crie uma classe com algumas propriedades, instancie alguns objetos e insira na lista.
Gostei + 0
26/09/2013
Pjava
var testaGrid = new[] { new { COD_PRESTADOR = "407630448", COD_SERVICO = "40301630", NM_SERVICO="Creatinina", QTD_REALIZADA="1",TIPO_TABELA="Tabela Própria",
GRAU_PARTICIPACAO="", DT_REALIZACAO="07/05/2013",STATUS_ITEM="Glosado Parcial",VL_COBRADO="3,90",
VL_PAGO="3,75",VL_GLOSADO="0,15",VL_RECUPERADO="0,10",NR_NOTAFISCAL="2564789-A00-016"} };
gvItemNotaFiscal.DataSource = testaGrid;
gvItemNotaFiscal.DataBind();
Gostei + 0
26/09/2013
Joel Rodrigues
Ou seja, tem um vetor com 1 item e esse item tem várias propriedades que representam as colunas, exatamente como eu lhe disse.
Que bom que deu certo, estou concluindo o tópico.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)