I have a problem with a asp:GridView
that is not updating data, in HTML I have the following:
<asp:GridView ID="ResultadosTest" runat="server" CssClass="table table-bordered bs-table" AutoGenerateColumns="false" EmptyDataText="No existen datos que mostrar" >
<Columns>
<asp:BoundField DataField="NombreServicio" HeaderText="Seccion" ReadOnly="True" />
<asp:BoundField DataField="Resultado" HeaderText="Resultado" ReadOnly="True" />
</Columns>
</asp:GridView>
And in Code behind when loading the page:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable table = new DataTable();
table.Columns.AddRange(new DataColumn[2] { new DataColumn("NombreServicio", typeof(string)), new DataColumn("Resultado", typeof(bool)) });
ResultadosTest.DataSource = table;
ResultadosTest.DataBind();
}
}
Later with a button that gathers data and fills a DataTable
(it was verified that the DataTable
if it brings data):
protected void GoPruebas_Click(object sender, EventArgs e)
{
ResultadosTest.DataSource = ValidacionesServicio(chkBoxAmbientes.Items[i].Value).Result;
ResultadosTest.DataBind();
}
But the data is not shown, what is going wrong?