GridView Caption(標題)

摘要:GridView Caption(標題)

1.方法一 

    <asp:gridview id="CustomersGridView"

        datasourceid="CustomersSource"

        autogeneratecolumns="true"

        emptydatatext="No data available."

        allowpaging="true"

       caption="顯示標題文字"

        captionalign="Top"  

        runat="server">               

      </asp:gridview>

參考資料

http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.gridview.caption(v=vs.100).aspx

2.方法二

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        GridView2.Caption = "列印日期:" + Now.ToShortDateString().ToString() + "<br>製表人:DANIEL"
        'GridView2.Caption為GridView2的標題文字,其中<br>為換行
        GridView2.CaptionAlign = TableCaptionAlign.Right
        'GridView2.CaptionAlign為GridView2的標題文字對齊方式
    End Sub