Today by the DataFormatString attribute pit one day, the development environment Test format came out in line with the expectations, and the deployment to the production environment does not work, and later compared to the environment, with multiple virtual machines deployed different environment version to do the test, finally get the following points of understanding.
① field type must be datetime type, this is not too much problem;
Formatting patterns such as ②d,d depend on the appropriate date format defined by regional and language options in the server environment, and if you want to ensure consistent formatting, you need to specify a specific format, such as {0:yyyy ' MM ' DD ' Day};
③.net version under 3.5 must mate htmlencode= "False" attribute, otherwise it doesn't work, this pit me a day ah, The development environment from 1.1 to 4.0 is full, and the production environment is 2.0, then I tested 3.0 and 3.5 environment, finally get the conclusion, 3.5 above do not have to match the HTMLEncode property, and 3.5 below to set HTMLEncode to False can be normal.
GridView control Field Properties DataFormatString deep in a heap of pits