E
Eamonn
Hi
I am running Microsoft Visual Studio 2005 Team Edition Version
8.0.50727.42. I am adding columns to a GridView at runtime. When I add
a BoundField that will contain DateTime data I want to format the date
so I use:
BoundField.DataFormatString = <myDateFormat>
However it just displays the date formatting string in the GridView and
not the formatted date. I tried setting the HtmlEncode value for the
column to both true and false, but it makes no difference. A snippet of
my code is below. Any help would be appreciated.
Thanks
Eamonn
//BoundField
case (int)DSSCaseColumn.DataControlFields.BoundField:
BoundField boundField = new BoundField();
boundField.DataField = column.DatabaseFieldName;
boundField.HeaderText = column.HeaderText;
SetFieldWidth(boundField, column.PercentageColumnWidth);
if (column.IsDate == true)
{
boundField.HtmlEncode = true;
boundField.DataFormatString =
Constants.GRIDVIEW_DATE_DISPLAY_FORMAT.ToString();
}
SelectGridViewCases.Columns.Add(boundField);
break;
I am running Microsoft Visual Studio 2005 Team Edition Version
8.0.50727.42. I am adding columns to a GridView at runtime. When I add
a BoundField that will contain DateTime data I want to format the date
so I use:
BoundField.DataFormatString = <myDateFormat>
However it just displays the date formatting string in the GridView and
not the formatted date. I tried setting the HtmlEncode value for the
column to both true and false, but it makes no difference. A snippet of
my code is below. Any help would be appreciated.
Thanks
Eamonn
//BoundField
case (int)DSSCaseColumn.DataControlFields.BoundField:
BoundField boundField = new BoundField();
boundField.DataField = column.DatabaseFieldName;
boundField.HeaderText = column.HeaderText;
SetFieldWidth(boundField, column.PercentageColumnWidth);
if (column.IsDate == true)
{
boundField.HtmlEncode = true;
boundField.DataFormatString =
Constants.GRIDVIEW_DATE_DISPLAY_FORMAT.ToString();
}
SelectGridViewCases.Columns.Add(boundField);
break;