0

I have dataset as you can see below.I want to hide first three columns. But the way I do below doesnt work. How can I do hide them?

// Read all posts and fill  gridview
    //////////////////////////////////////////////////
    DbCommand dbCommand2;
    dbCommand2 = db.GetStoredProcCommand("PC_Select_News");
    db.AddInParameter(dbCommand2, "UserId", DbType.Guid, new Guid(Session["SessionUserId"].ToString().Trim()));
    DataSet ds = db.ExecuteDataSet(dbCommand2);
    grid_all_posts.DataSource = ds;

    grid_all_posts.DataBind();
    grid_all_posts.Columns[1].Visible = false;
    grid_all_posts.Columns[2].Visible = false;
Arif Yilmaz
  • 121
  • 2
  • 4
  • 14

1 Answers1

1

Try using () instead of [].

gvMyGrid.Columns(0).Visible == false;

The above works fine for me.

Jim
  • 737
  • 3
  • 12
  • 27