WebGrid.GetHtml 方法

定义

返回用于呈现 WebGrid 实例的 HTML 标记,并使用指定的分页选项。

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 链接元素的文本。 FirstLast必须设置 参数的mode标志才能显示此页面导航元素。

previousText
String

用于链接到实例上一页的 WebGrid HTML 链接元素的文本。 NextPrevious必须设置 参数的mode标志才能显示此页面导航元素。

nextText
String

用于链接到实例的下一页 WebGrid 的 HTML 链接元素的文本。 NextPrevious必须设置 参数的mode标志才能显示此页面导航元素。

lastText
String

用于链接到实例最后一页 WebGrid 的 HTML 链接元素的文本。 FirstLast必须设置 参数的mode标志才能显示此页面导航元素。

numericLinksCount
Int32

提供给附近 WebGrid 页面的数字页链接数。 每个数字页链接的文本都包含页码。 Numeric必须设置 参数的mode标志以显示这些页面导航元素。

htmlAttributes
Object

一个 对象,表示属性集合, (名称和值) 为表示 WebGrid 实例的 HTML 表元素设置。

返回

表示完全填充 WebGrid 实例的 HTML 标记。

适用于