gridview時間欄位轉成日期,數字欄位轉成千分位

  • 434
  • 0

取得瀏覽器目前設定語系

Response.Write(System.Threading.Thread.CurrentThread.CurrentUICulture.ToString());

把時間設定成日期,把數字設定成千分位

 

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
                <Columns>
                    <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
                    <asp:BoundField DataField="ytd_sales" HeaderText="ytd_sales" SortExpression="ytd_sales" DataFormatString="{0:N}" />
                    <asp:BoundField DataField="pubdate" HeaderText="pubdate" SortExpression="pubdate" DataFormatString="{0:d}" />
                </Columns>
            </asp:GridView>