title: ASP.Net GridView Web Control Format Columns
body: <p>I'm trying to format columns in the GridView control by placing code inside the DataBound event.  It doesn't work, because for some reason the columns collection is not populated.  The control is bound, it works, but yet the columns collection is showing a count of zero, and so the code doesn't work.<br>
  Ideas?</p>
  
  <pre><code>        protected void gvReport_DataBound(object sender, EventArgs e)
      {
          for (int columnIndex = 0; columnIndex &lt;= gvReport.Columns.Count - 1; columnIndex += 1)
          {
              var col = ((BoundField)gvReport.Columns[columnIndex]);
  
              if (object.ReferenceEquals(col.DataField.GetType(), typeof(System.DateTime)))
                  col.DataFormatString = "MM/dd/yyyy";
          }
      }
  </code></pre>