Fórmulas e Cenas

Object Reference Not Set to Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 0 Stories | 6 Comments | 0 Trackbacks

News

Archives

Post Categories

Links

Thursday, October 29, 2009 #

Hello,

If you are reading this you probably have already realized that it is not possible to hide a column that was auto-generated using myGridView.Columns[index].Visible=false;
To achieve this you must:
1 - set the OnRowCreated to execute a function, something like OnRowCreated="gridRowCreated"
2 - Create your function as such:

protected void gridRowCreated(object sender, GridViewRowEventArgs e)
        {
            e.Row.Cells[yourIndexHere].Visible = false;
        }

Hope this helps ;)
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati