title: How to change datagridview column date format when gridview has autogeneratecolumns=true
body: <p>I am auto generating columns in gridview depending on search parameters, few columns will be added or removed. </p>
  
  <p>Please suggest me a way to set the date format to <code>dd-mmm-yyyy</code> for entire column in gridview.</p>
  
  <p>For now, I'm doing it using <code>rowdatabound</code>. It checks every row, So it takes time to show the results.</p>
  
  <p>This is what I do in <code>rowdatabound</code></p>
  
  <pre><code>if (e.Row.RowType == DataControlRowType.DataRow)
  {
          System.Data.DataRowView dtview;
          DateTime dt;
          int intCounter;
          dtview = (DataRowView)e.Row.DataItem;
  
          for (intCounter = 0; intCounter &lt;= dtview.Row.ItemArray.Length - 1; intCounter++)
          {
              if (dtview.Row.ItemArray[intCounter] is System.DateTime)
              {
                  dt = (DateTime)dtview.Row.ItemArray[intCounter];
                  e.Row.Cells[intCounter].Text = dt.ToString("dd-MMM-yyyy");
              }
          }
      }
  </code></pre>
  
  <p>This checks for all records and then changes based on condition.</p>
  
  <p>But I want to do it better, just by identifying the column and change the date format for complete column.</p>