是否有可能从gridview中隐藏列

是否有可能从gridview中隐藏列

本文介绍了即使从DB获取该值,是否有可能从gridview中隐藏列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用数据库中的一些列填充了一个网格视图,并按照以下步骤发送参数:

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.我的问题在上面的评论代码中设置。

提前感谢您的回复。

干杯。


P.S. My question is set on the comment code above.
Thank you in advance for your reply.
Cheers.

推荐答案

  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;



这篇关于即使从DB获取该值,是否有可能从gridview中隐藏列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:47