设定BoundField的DataFormatString,通常有以下几种
DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Culture的设置
DataFormatString= "{0:E}" 科学计数法
DataFormatString= "{0: P}" 百分比
DataFormatString= "{0:F?}" 小数点后几位
DataFormatString= "{0:d}" M/d/yyyy 如 10/30/2008
DataFormatString= "{0:f}" 长日期,短时间。dddd,MMMM dd,yyyy HH:mm aa 如, Monday, January30, 2008 10:00am
DataFormatString= "{0: D}" 长日期。dddd,MMMM dd,yyyy 如: Monday,January 30,2008
DataFormatString= "{0:F}" 长日期,长时间 dddd,MMMM dd,yyyy HH:mm:ss aa
DataFormatString= "{0: s}" ISO 标准时间。yyyy-MM-ddTHH:mm:ss,如: 2008-01-30T10:20:55am
DataFormatString= "{0:M}" 月份和日期 MMMM dd,如January30
DataFormatString= "{0:G}" 一般格式 M/d/yyyy HH:mm:ss aa
-----------------------------------------------------------------
格式字符串 输入 结果
"{0:C}" 12345.6789 $12,345.68
"{0:C}" -12345.6789 ($12,345.68)
"{0:D}" 12345 12345
"{0:D8}" 12345 00012345
"{0:E}" 12345.6789 1234568E+004
"{0:E10}" 12345.6789 1.2345678900E+004
"{0:F}" 12345.6789 12345.68
"{0:F0}" 12345.6789 12346
"{0:G}" 12345.6789 12345.6789
"{0:G7}" 123456789 1.234568E8
"{0:N}" 12345.6789 12,345.68
"{0:N4}" 123456789 123,456,789.0000
"Total: {0:C}" 12345.6789 Total: $12345.68

DataFormatString="¥{0:C}"。
常用的日期时间格式:
格式 说明 输出格式
d 精简日期格式 MM/dd/yyyy
D 详细日期格式 dddd, MMMM dd, yyyy
f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm
F
完整日期时间格式
(long date + long time)
dddd, MMMM dd, yyyy HH:mm:ss
g 一般格式 (short date + short time) MM/dd/yyyy HH:mm
G 一般格式 (short date + long time) MM/dd/yyyy HH:mm:ss
m,M 月日格式 MMMM dd
s 适中日期时间格式 yyyy-MM-dd HH:mm:ss
t 精简时间格式 HH:mm
T 详细时间格式 HH:mm:ss

<%#   String.Format("{0:yyyy-MM-dd} ", Eval("EffectiveDate "))%>

<%#   String.Format("{0:yyyy-M-d} ", DataBinder.Eval(Container.DataItem, "EffectiveDate "))%>

数据绑定之DataFormatString的更多相关文章

  1. c# 数据绑定之 DataFormatString 格式

    数据绑定之DataFormatString 设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货 ...

  2. [转]数据绑定之DataFormatString

    设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Cultur ...

  3. DataFormatString 转

    数据绑定之DataFormatString 设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货 ...

  4. GridView的七种数据绑定列的类型

    1.BoundField 用于显示普通文本,是默认的数据绑定列的类型,一般自动生成的列就是该类型,需要注意是DataFormatString属性,该属性可以设置显示的格式,常见格式有:{0:C} 设置 ...

  5. UWP中新加的数据绑定方式x:Bind分析总结

    UWP中新加的数据绑定方式x:Bind分析总结 0x00 UWP中的x:Bind 由之前有过WPF开发经验,所以在学习UWP的时候直接省略了XAML.数据绑定等几个看着十分眼熟的主题.学习过程中倒是也 ...

  6. MVVM模式和在WPF中的实现(二)数据绑定

    MVVM模式解析和在WPF中的实现(二) 数据绑定 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在WPF中 ...

  7. 前端MVC学习总结(一)——MVC概要与angular概要、模板与数据绑定

    一.前端MVC概要 1.1.库与框架的区别 框架是一个软件的半成品,在全局范围内给了大的约束.库是工具,在单点上给我们提供功能.框架是依赖库的.AngularJS是框架而jQuery则是库. 1.2. ...

  8. vue双向数据绑定原理探究(附demo)

    昨天被导师叫去研究了一下vue的双向数据绑定原理...本来以为原理的东西都非常高深,没想到vue的双向绑定真的很好理解啊...自己动手写了一个. 传送门 双向绑定的思想 双向数据绑定的思想就是数据层与 ...

  9. 【Win 10应用开发】分阶段进行数据绑定

    使用x:Bind扩展标记进行数据绑定,是在编译阶段完成,至于说性能优化方面,大概主要是优化CPU资源的使用,因为免去了运行阶段进行绑定的过程.当然,使用这个标记仅仅是绑定上的优化,并不包括数据源.数据 ...

随机推荐

  1. unity3d游戏开发——新手引导

    GUI实现,如下: 按“G”键开始新手引导 代码如下: using UnityEngine; using System.Collections; public class OkButton : GUI ...

  2. ms-grid layout

    <!DOCTYPE html> <html> <head> <title></title> <script src="js/ ...

  3. [Jquery] Jquery获取浏览器宽高的代码

    <script type="text/javascript"> $(document).ready(function() { alert($(window).heigh ...

  4. r个有标志的球放进n个不同的盒子里,要求无一空盒,问有多少种不同的分配方案?

           由题意可知道r>=n,我原来想的是先取n个全排列,剩下的r-n个每个有n中选择,所以结果是n!*n^(r-n).经满神猜测,这样是会重复的.比如说,1到5个球,ABC三个盒子,ms ...

  5. [CC150] Get all permutations of a string

    Problem: Compute all permutations of a string of unique characters. 此题用循环的方式不好做,下面是一种递归的思路: 把给的字符串看成 ...

  6. 背景CSS

    .op_weather4_twoicon_day:hover .op_weather4_twoicon_hover { background-image: -webkit-linear-gradien ...

  7. 【无聊放个模板系列】HDU 3068 MANACHER

    #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #inc ...

  8. char 与 unsigned char的本质区别

    在C中,默认的基础数据类型均为signed,现在我们以char为例,说明(signed) char与unsigned char之间的区别 首先在内存中,char与unsigned char没有什么不同 ...

  9. Git push错误non-fast-forward后的冲突解决

    当要push代码到git时,出现提示: error:failed to push some refs to ... Dealing with “non-fast-forward” errorsFrom ...

  10. TigerLeapMC V1.3 for Windows(支持DLNA)

    TigerLeapMC V1.3 2014-04-10: 1.更新tlplayer TigerLeapMC是基于tlplayer作为播放器的集成DLNA,(DMS,DMR,DMP)等,支持各种网络播放 ...