Witam mam taki kod:
protected void BtnForm_Click1(object sender, EventArgs e)
{
if (BtnForm.Text == "Wyświetl formularz")
{
string tab = string.Empty;
tab = "<table class=\"borderTable\"><tr>";
tab += string.Format("<th>Płeć</th><th>Data Wysłania</th>");
SqlConnection sc = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("TT_Form_Get", sc);
//da.SelectCommand.CommandType = CommandType.StoredProcedure;
//da.SelectCommand.Parameters.Add("@Sex", SqlDbType.NVarChar, 50);
//da.SelectCommand.Parameters.Add("@DateSend", SqlDbType.NVarChar, 50);
DataTable dt = new DataTable();
da.Fill(dt);
sc.Open();
DataRow[] dr = dt.Select();
sc.Close();
for (int i = 0; i < dr.Length; i++)
{
tab += string.Format("<tr><td>{0}</td><td>{1}</td></tr>",
dr[i]["Sex"].ToString(), dr[i]["DateSend"].ToString());
}
tab += "</tr></table>";
LitType2.Text = tab;
BtnFromAll.Visible = true;
BtnForm.Text = "Ukryj formularz";
LitType2.Visible = true;
GridView1.Visible = true;
GridView1.DataSource = dt;
GridView1.DataBind();
GridView1.HeaderRow.Cells[0].Text = "Płeć";
GridView1.HeaderRow.Cells[1].Text = "Wiek";
GridView1.HeaderRow.Cells[2].Text = "Rodzaj";
GridView1.HeaderRow.Cells[3].Text = "Marka";
GridView1.HeaderRow.Cells[4].Text = "Wysokość obcasu";
GridView1.HeaderRow.Cells[5].Text = "Data wysłania";
GridView1.HeaderRow.Cells[6].Text = "Adres IP";
}
else
{
BtnFromAll.Visible = false;
BtnForm.Text = "Wyświetl formularz";
LitType2.Visible = false;
GridView1.Visible = false;
}
Jestem początkującym a więc mam śmietnik w kodzie , oraz wyswietlanie tabelki w kontrolce Lit. , testuje sobie GridView ale nie mam pojęcia jak ukryć kolumny chce mieć wyświetlone tylko Płeć i Date wysłania.