WebGrid.GetHtml 方法

定義

傳回 HTML 標籤,這個標記是用來轉譯 WebGrid 實例,以及使用指定的分頁選項。

public System.Web.IHtmlString GetHtml (string tableStyle = default, string headerStyle = default, string footerStyle = default, string rowStyle = default, string alternatingRowStyle = default, string selectedRowStyle = default, string caption = default, bool displayHeader = true, bool fillEmptyRows = false, string emptyRowCellValue = default, System.Collections.Generic.IEnumerable<System.Web.Helpers.WebGridColumn> columns = default, System.Collections.Generic.IEnumerable<string> exclusions = default, System.Web.Helpers.WebGridPagerModes mode = System.Web.Helpers.WebGridPagerModes.NextPrevious | System.Web.Helpers.WebGridPagerModes.Numeric, string firstText = default, string previousText = default, string nextText = default, string lastText = default, int numericLinksCount = 5, object htmlAttributes = default);
member this.GetHtml : string * string * string * string * string * string * string * bool * bool * string * seq<System.Web.Helpers.WebGridColumn> * seq<string> * System.Web.Helpers.WebGridPagerModes * string * string * string * string * int * obj -> System.Web.IHtmlString
Public Function GetHtml (Optional tableStyle As String = null, Optional headerStyle As String = null, Optional footerStyle As String = null, Optional rowStyle As String = null, Optional alternatingRowStyle As String = null, Optional selectedRowStyle As String = null, Optional caption As String = null, Optional displayHeader As Boolean = true, Optional fillEmptyRows As Boolean = false, Optional emptyRowCellValue As String = null, Optional columns As IEnumerable(Of WebGridColumn) = null, Optional exclusions As IEnumerable(Of String) = null, Optional mode As WebGridPagerModes = System.Web.Helpers.WebGridPagerModes.NextPrevious | System.Web.Helpers.WebGridPagerModes.Numeric, Optional firstText As String = null, Optional previousText As String = null, Optional nextText As String = null, Optional lastText As String = null, Optional numericLinksCount As Integer = 5, Optional htmlAttributes As Object = null) As IHtmlString

參數

tableStyle
String

用來設定整張資料表樣式之 CSS 類別的名稱。

headerStyle
String

用來設定資料表頁首樣式之 CSS 類別的名稱。

footerStyle
String

用來設定資料表頁尾樣式之 CSS 類別的名稱。

rowStyle
String

用來設定每個資料表資料列樣式之 CSS 類別的名稱。

alternatingRowStyle
String

用來設定偶數資料表資料列樣式之 CSS 類別的名稱。

selectedRowStyle
String

用來設定所選取資料表資料列之 CSS 類別的名稱 (一次只能選取一個資料列)。

caption
String

資料表標題。

displayHeader
Boolean

true 表示顯示資料表標頭;否則為 false。 預設值是 true。

fillEmptyRows
Boolean

true 表示當資料項目不足而無法填滿最後一頁時,在最後一頁插入其他資料列;否則為 false。 預設值為 false。 其他資料列會使用 參數指定的 emptyRowCellValue 文字填入。

emptyRowCellValue
String

用來在資料項目不足以填入最後一個頁面時填入頁面中之其他資料列的文字。 參數 fillEmptyRows 必須設定為 true,才能顯示這些額外的資料列。

columns
IEnumerable<WebGridColumn>

實例的 WebGridColumn 集合,指定每個資料行的顯示方式。 這包括與每個格線資料行相關聯的資料行,以及如何格式化每個格線資料行所含的資料值。

exclusions
IEnumerable<String>

包含要在格線自動填入資料行時排除之資料行名稱的集合。

mode
WebGridPagerModes

列舉值的位元組合,指定用來在實例頁面 WebGrid 之間移動的方法。

firstText
String

用來連結至實例第一頁之 WebGrid HTML 連結專案的文字。 參數 FirstLastmode 旗標必須設定為顯示此頁面導覽專案。

previousText
String

用來連結至實例上一頁之 WebGrid HTML 連結專案的文字。 參數 NextPreviousmode 旗標必須設定為顯示此頁面導覽專案。

nextText
String

用來連結至實例下一頁之 WebGrid HTML 連結專案的文字。 參數 NextPreviousmode 旗標必須設定為顯示此頁面導覽專案。

lastText
String

用來連結至實例最後一頁之 WebGrid HTML 連結專案的文字。 參數 FirstLastmode 旗標必須設定為顯示此頁面導覽專案。

numericLinksCount
Int32

提供給附近 WebGrid 頁面的數值頁面連結數目。 每個數值頁面連結的文字包含頁碼。 參數 Numericmode 旗標必須設定為顯示這些頁面導覽元素。

htmlAttributes
Object

物件,表示屬性集合 (名稱和值,) 為代表 WebGrid 實例的 HTML 資料表專案設定。

傳回

表示完整填入 WebGrid 實例的 HTML 標籤。

適用於