2
The grid is already being mounted correctly. However when I give a Postback by clicking on some button on the page, the grid is maintained and only the headers (lines in purple) disappear. I know if I call the method to reload the grid again, it works, but it doesn’t seem like a good thing to do.
Code for creating dynamic headers.
protected void grvAvaliacao_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Se mudar o Head
if (!DataBinder.Eval(e.Row.DataItem, "NAT_Nome").Equals(Session["Competencia"]))
{
Session["Competencia"] = DataBinder.Eval(e.Row.DataItem, "NAT_Nome");
this.head = true;
}
if (this.head)
{
GridViewRow linha = CriarCabecalho(e);
//linha -> tabela
var tabela = e.Row.Parent as Table;
tabela.Rows.AddAt(tabela.Rows.Count - 1, linha);
this.head = false;
}
}
}
Add the Page_load code. There you have to check if ! Ispostback. [This graphical interface/ table is beautiful]
– Tony
Hello Tony! Yes there I already do this check, but the loading of my grid is in the event of a button.
– alexander Pataki