I have this problem, when the table is empty, the GridView does not show the row headers i use .net framework 4 and internet Explorer,Can you help me? this is the code:
this is code
private void loadTCOR27()
{
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
try
{
string sql = null;
gridViewTCOR27.Visible = true;
table1.Visible = false;
string connectionString = SestanteWeb.Global.rCRVigServer.leggiStringaConnessioneSicurezzaSqlClient();
sql = "select * FROM [PUMA2_FINANZIARIAFAMILIARE].[dbo].[TCOR27]";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
adapter.SelectCommand = command;
adapter.Fill(ds);
adapter.Dispose();
command.Dispose();
connection.Close();
// gridView1.DataSource = ds.Tables[0];
gridViewTCOR27.DataSource = ds.Tables[0];
gridViewTCOR27.DataBind();
}
catch (Exception ex)
{
}
finally
{
adapter.Dispose();
}
}