0

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.

2
Contributors
1
Reply
13
Views
1 Year
Discussion Span
Last Post by Taywin
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.