设定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 
常用的日期时间格式: 
格式 说明 输出格式 
d 精简日期格式 MM/dd/yyyy 
D 详细日期格式 dddd, MMMM dd, yyyy 
f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm 

完整日期时间格式 
(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 "))%>

c# 数据绑定之 DataFormatString 格式的更多相关文章

  1. 数据绑定之DataFormatString

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

  2. [转]数据绑定之DataFormatString

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

  3. DataFormatString 转

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

  4. gridview DataFormatString 属性设置须知

    设置 DataFormatString 进行格式化数据时默认情况下是不会起作用的还有设置HtmlEncode = "false" 具体为什么?以下几点1. 在GridView中的a ...

  5. SpringMVC中注解控制器及数据绑定

    一.Spring2.5之前,我们都是通过实现Controller接口或其他实现来定义我们的处理器类. 二.Spring2.5引入注解式处理器支持,通过@Controller 和 @RequestMap ...

  6. 用FlexGrid做开发,轻松处理百万级表格数据

    表格数据处理是我们项目开发中经常会遇到的设计需求之一,所需处理的数据量也较大,通常是万级.甚至百万级.此时,完全依赖平台自带的表格工具,往往无法加载如此大的数据量,或者加载得很慢影响程序执行. 那么, ...

  7. Spring3.1新特性(转)

    一.Spring2.5之前,我们都是通过实现Controller接口或其他实现来定义我们的处理器类. 二.Spring2.5引入注解式处理器支持,通过@Controller 和 @RequestMap ...

  8. Asp.net GridView控件使用纪要

    1:数据绑定 GridView 支持数据绑定的数据源格式比较多,例如可以使用ObjectDataSource绑定数据源, Dataset,datatable,List<T>等 2:列绑定 ...

  9. SpringMVC讲解

    2.1.Spring Web MVC是什么 Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职 ...

随机推荐

  1. 2015安徽省赛 A.First Blood

    题目描述 盖伦是个小学一年级的学生,在一次数学课的时候,老师给他们出了一个难题: 老师给了一个正整数 n,需要在不大于n的范围内选择三个正整数(可以是相同的),使它们三个的最小公倍数尽可能的大.盖伦很 ...

  2. 【Python】python代码如何调试?

    Python 程序如何高效地调试? 现在我在debug python程序就只是简单在有可能错误的地方print出来看一下,不知道python有没像c++的一些IDE一样有单步调试这类的工具?或者说各位 ...

  3. 《ASP.NET1200例》嵌套在DataLisT控件中的其他服务器控件---DropDownList控件的数据绑定

    aspx <script type="text/javascript"> function CheckAll(Obj) { var AllObj = document. ...

  4. Longest Consecutive Sequence

    Given an unsorted array of integers, find the length of the longest consecutive elements sequence. C ...

  5. 3Sum Closest & 3Sum Smaller

    Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...

  6. Copy List with Random Pointer

    A linked list is given such that each node contains an additional random pointer which could point t ...

  7. javascript的事件监听与捕获和冒泡

    在前端开发中,我们经常需要对某些事件进行监听.这样只要在指定的元素上触发了该事件,就会执行一个回调来进行相关的操作. 而js中事件监听方法总共有三种,分别如下所示: element.addEventL ...

  8. Solr DIH导入出现 Data Config problem: 前言中不允许有内容 异常

    Solr配置DIH导入时出现 “Data Config problem: 前言中不允许有内容.” 异常. <response> <lst name="responseHea ...

  9. java操作AJAX

    1,get方式的AJAX function sendAjaxReq() { //1,创建ajax引擎 XMLHttpRequest对象 var req = new XMLHttpRequest() | ...

  10. nodeJS文件路径总结

    文件夹目录F:* test1* tes2* test3* test4* a.html*//例句fs.readFile('../../../a.html', function (err, html) { ...