Hi there Billie,
you have to handle RowDataBound event
-- aspx page --
<asp:GridView runat="server" ID="gridView"
AutoGenerateColumns="true"
OnRowDataBound="gridView_RowDataBound">
-- end aspx page --
-- code beside --
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRow row = ((DataRowView)e.Row.DataItem).Row;
int index = GetDateColumnIndex(row);
e.Row.Cells[index].Text = ((DateTime)
row[index]).ToString("dd/MM/yyyyyyyy-MM-dd");
}
}
private int dateColumnIndex = -1;
private int GetDateColumnIndex(DataRow row)
{
if (this.dateColumnIndex == -1)
{
this.dateColumnIndex =
row.Table.Columns.IndexOf("ItemRecieved");
if (dateColumnIndex < 0)
{
throw new Exception(
"datasource does not contain the MyDateColumn column");
}
}
return this.dateColumnIndex;
}
-- end code beside --
Hope this helps

Signature
Milosz
> I am populating a gridview using auto-generated fields, because I need to
> enable sorting.
[quoted text clipped - 5 lines]
> Thanks
> Bill
BillE - 18 Jun 2007 15:09 GMT
Thank you kindly.
> Hi there Billie,
>
[quoted text clipped - 54 lines]
>> Thanks
>> Bill