惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
Jina AI
Jina AI
博客园_首页
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Forbes - Security
Forbes - Security
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
N
News | PayPal Newsroom
S
Security Archives - TechRepublic
量子位
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
C
Cisco Blogs
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Scott Helme
Scott Helme
S
Securelist
Security Latest
Security Latest
爱范儿
爱范儿
TaoSecurity Blog
TaoSecurity Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
美团技术团队
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
月光博客
月光博客
T
Tailwind CSS Blog
Cloudbric
Cloudbric
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
D
DataBreaches.Net
博客园 - 【当耐特】
有赞技术团队
有赞技术团队

博客园 - 鬼蝶[DFCG]

Mono.Cecil 修改目标.NET的IL代码保存时报异常的处理。 博文阅读密码验证 - 博客园 [转载]斐讯K2 A2版免TTL刷BREED不死Bootloader 博文阅读密码验证 - 博客园 各种UserAgent的列表 自制Console线(已测试CISCO3560可用) [转载]在Vmware ESXI中安装群晖Synology DSM 5.0 (4528) .NET 相关工具 .NET 4.5 HttpClient 中使用Cookie C# 实现快速闪电关机、快速重启 HttpWebRequest常用问题! WebBrowser处理AJAX生成的网页内容! HttpWebRequest请求超时的解决方案! 用正则表达式过滤HTML隐藏SPAN AMF入门教程 正则表达式30分钟入门 [转载]Reflector反编译.NET文件后修复 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序。 windows 2008r2解决此错误提示。 TT双拨脚本
GridView 绑定数据的常用指定格式。
鬼蝶[DFCG] · 2014-07-26 · via 博客园 - 鬼蝶[DFCG]

形式

语法

结果

注释

数字

{0:N2}

12.36

 

数字

{0:N0}

13

 

货币

{0:c2}

$12.36

 

货币

{0:c4}

$12.3656

 

货币

"¥{0:N2}"

¥12.36

 

科学计数法

{0:E3}

1.23E+001

 

百分数

{0:P}

12.25%

P and p present the same.

日期

{0:D}

2006年11月25日

 

日期

{0:d}

2006-11-25

 

日期

{0:f}

2006年11月25日 10:30

 

日期

{0:F}

2006年11月25日 10:30:00

 

日期

{0:s}

2006-11-25 10:30:00

 

时间

{0:T}

10:30:00

 

在GridView中操作的时候要注意以下的几个方面(以{0:d}为例)

1.要绑定的列如果单纯的是boundfiled类型的(如下)

<asp:BoundField DataField="sj" HeaderText="时间" ReadOnly="True" DataFormatString="{0:d}" />

显示出来的格式还是2006-11-25 0:00:00 为达到我们想要的效果

2.要绑定的列必须是模板列如下:这样才能看到我们想要看到的效果:2006-11-25

<asp:TemplateField HeaderText="时间">

   <EditItemTemplate>

          <asp:Label ID="Label1" runat="server" Text='<%# Eval("sj", "{0:d}") %>'></asp:Label>

</EditItemTemplate>

<ItemTemplate>

          <asp:Label ID="Label2" runat="server" Text='<%# Bind("sj", "{0:d}") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>