Is there a possibility to hide a column from gridview even if you get that value from DB?
I have populated a grid view with some columns from database with following procedure sending a parameter:
SqlConnection sqlConn = new SqlConnection(StringKoneksioni.Stringu);
using (sqlConn)
{
SqlCommand sqlCmd = new SqlCommand("procProcedureName", sqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.Add(new SqlParameter("@Parameter", SqlDbType.VarChar));
sqlCmd.Parameters["@Parameter"].Value = Session["Parameter"];
sqlConn.Open();
SqlDataReader reader = sqlCmd.ExecuteReader();
gvName.DataSource = reader;
gvName.DataBind();
///All I want is to hide the following column from grid view but use its value. How to solve this?
gvName.Columns[10].Visible = false;
sqlConn.Close();
}
P.S. My question is set on the comment code above.
Thank you in advance for your reply.
Cheers.