• GridView列数字、货币和日期的显示格式


    形式 语法 结果 注释
    数字 {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-26 10:30:00  
    时间 {0:T} 10:30:00  
    在设置GridView数据绑定控件的模版列时,总要设置显示的格式,这里是我查询一些资料后统计出来的。还有一个常规的选项是用数据库中默认的格式显示。

    protected void DataList1_ItemCreated(object sender, DataListItemEventArgs e)
        
    {
            
    //在创建行的时候触发的事件
            if (e.Item.ItemType == ListItemType.Footer)
            
    {//判断是脚模板
                PlaceHolder pl = new PlaceHolder();
                
    //动态创建一个PlaceHolder用来装页码
                e.Item.Controls.Add(pl);
                
    //把PlaceHolder增加到脚模板中去
                Label lbl = new Label();
                
    //new一个Label,当然,如果这要做页码的话,建议就做成linkbutton了,呵呵
                lbl.Text = "123";

                pl.Controls.Add(lbl);
                
    //把lbl增加到PlaceHolder中去
            }

        }
  • 相关阅读:
    python编码基础知识
    python编码问题
    python中文乱码
    mysql sql灵活运用
    MySQL函数讲解(MySQL函数大全)
    python:UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xef in position xxx: ordinal not in range(128)
    sql replace into 与 insert into
    微信布局
    盘点六大在中国复制失败的O2O案例
    字符串问题(一)
  • 原文地址:https://www.cnblogs.com/adam/p/1028841.html
Copyright © 2020-2023  润新知