Share via


WebGrid.GetHtml Method

Definition

Returns the HTML markup that is used to render the WebGrid instance and using the specified paging options.

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

Parameters

tableStyle
String

The name of the CSS class that is used to style the whole table.

headerStyle
String

The name of the CSS class that is used to style the table header.

footerStyle
String

The name of the CSS class that is used to style the table footer.

rowStyle
String

The name of the CSS class that is used to style each table row.

alternatingRowStyle
String

The name of the CSS class that is used to style even-numbered table rows.

selectedRowStyle
String

The name of the CSS class that is used to style the selected table row. (Only one row can be selected at a time.)

caption
String

The table caption.

displayHeader
Boolean

true to display the table header; otherwise, false. The default is true.

fillEmptyRows
Boolean

true to insert additional rows in the last page when there are insufficient data items to fill the last page; otherwise, false. The default is false. Additional rows are populated using the text specified by the emptyRowCellValue parameter.

emptyRowCellValue
String

The text that is used to populate additional rows in a page when there are insufficient data items to fill the last page. The fillEmptyRows parameter must be set to true to display these additional rows.

columns
IEnumerable<WebGridColumn>

A collection of WebGridColumn instances that specify how each column is displayed. This includes which data column is associated with each grid column, and how to format the data values that each grid column contains.

exclusions
IEnumerable<String>

A collection that contains the names of the data columns to exclude when the grid auto-populates columns.

mode
WebGridPagerModes

A bitwise combination of the enumeration values that specify methods that are provided for moving between pages of the WebGrid instance.

firstText
String

The text for the HTML link element that is used to link to the first page of the WebGrid instance. The FirstLast flag of the mode parameter must be set to display this page navigation element.

previousText
String

The text for the HTML link element that is used to link to previous page of the WebGrid instance. The NextPrevious flag of the mode parameter must be set to display this page navigation element.

nextText
String

The text for the HTML link element that is used to link to the next page of the WebGrid instance. The NextPrevious flag of the mode parameter must be set to display this page navigation element.

lastText
String

The text for the HTML link element that is used to link to the last page of the WebGrid instance. The FirstLast flag of the mode parameter must be set to display this page navigation element.

numericLinksCount
Int32

The number of numeric page links that are provided to nearby WebGrid pages. The text of each numeric page link contains the page number. The Numeric flag of the mode parameter must be set to display these page navigation elements.

htmlAttributes
Object

An object that represents a collection of attributes (names and values) to set for the HTML table element that represents the WebGrid instance.

Returns

The HTML markup that represents the fully-populated WebGrid instance.

Applies to