1
I make a SELECT in the bank and mount my gridview, after that I make another SELECT and needed to add an extra column with the values that came.
I have a Foreach to go through all the lines of the second SELECT, and another Foreach to go through all gridview lines. If the course name exists in gridview, you would have to add this new column, with the course value (R$).
I’m trying like this, no mistake, but also not shown the new column.
List<Informacoes> list2 = dal.ValorCurso(candidato);
list2.ForEach(delegate (Informacoes dom)
{
string local = list2[dom.INDEX].CURSO;
foreach (GridViewRow row in this.gvInscricoesCurso.Rows)
{
if (local.Contains(row.Cells[0].Text))
{
TemplateField template = new TemplateField();
template.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
template.HeaderText = "Valor do curso";
gvInscricoesCurso.Columns.Add(template);
}
}
});
Someone would have a tip on how to do it or else another way?
To load the first time I do as follows, call for consultation and mounting of gridview:
Informacoes informacoes = new Informacoes();
Candidato candidato = new Candidato
{
CodColigada = Convert.ToInt16(ddlInstituicao.SelectedValue.Split('-')[0]),
CodFilial = Convert.ToInt16(ddlInstituicao.SelectedValue.Split('-')[1]),
};
DAL dal = new DAL();
DataTable dtInscritosCurso = dal.TotalInscritosCursoDetalhe(candidato);
gvInscricoesCurso.DataSource = dtInscritosCurso;
gvInscricoesCurso.DataBind();
And my query at the bank has enough lines, it would be too extensive to put in question, but is not returning any error.
You do like to carry the first time, I already see problems in the air ... ?
– novic
@Virgilionovic edited the question with the way I first carry
– PedroBelino
You need to do all this in SQL ...
– novic
@Virgilionovic Putz, the worst is that my query that makes the first call has 246 and is taking too long to load, so I wanted to do it this other way..
– PedroBelino
249 call what?
– novic
@Virgilionovic query has 246 lines
– PedroBelino