This is what I usually do: The code should be executed after DataGrid is data bound(DataGrid.DataBind() is called). So that it can edit DataGrid items. In post backs, you don't need to data bind DataGrid, because it is already data bound (in load), but you may need to run converting code in post backs, too. To do so, data bind DataGrid in page_load (use if(!IsPostBack)). Place code for modifying DataGrid in a separate method and call it in page_load (outside if(!IsPostBack)). If you are using ASP.NET 2, note that when you do data binding using a DataSource, you still need to call DataGrid.DataBind() in page_load. Because this method is called after page_load in page life cycle and you need to work on DataGrid in page_load, you must call it explicitly. But using ItemDataBound, it is much better and easier:
protected void dgrdWebSites\_ItemDataBound(object s, DataGridItemEventArgs e)
{
DateTime date = DateTime.Parse(e.Item.Cells\[1\].Text);
string text = date.Day + "/" + date.Month + "/" +
date.Year;
e.Item.Cells\[1\].Text = text;
}
Nothing more is needed! Let me know if you need more explanation. Best regards, lordfkiller