Tuesday, January 31, 2012

How to hide Gridview column at Runtime?


           try
            {
                MonoManager objDataManager = new MonoManager();
                GridView1.DataSource = objDataManager.GetVideos();
                GridView1.DataBind();


                GridView1.HeaderRow.Cells[2].Visible = false;
                foreach (GridViewRow gvr in GridView1.Rows)
                {
                    gvr.Cells[2].Visible = false;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }    

No comments: