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.Data FormatString = <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)DSSCaseCol umn.DataControl Fields.BoundFie ld:
BoundField boundField = new BoundField();
boundField.Data Field = column.Database FieldName;
boundField.Head erText = column.HeaderTe xt;
SetFieldWidth(b oundField, column.Percenta geColumnWidth);
if (column.IsDate == true)
{
boundField.Html Encode = true;
boundField.Data FormatString =
Constants.GRIDV IEW_DATE_DISPLA Y_FORMAT.ToStri ng();
}
SelectGridViewC ases.Columns.Ad d(boundField);
break;