WebGrid.GetHtml Method

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

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

public IHtmlString GetHtml(
	string tableStyle,
	string headerStyle,
	string footerStyle,
	string rowStyle,
	string alternatingRowStyle,
	string selectedRowStyle,
	string caption,
	bool displayHeader,
	bool fillEmptyRows,
	string emptyRowCellValue,
	IEnumerable<WebGridColumn> columns,
	IEnumerable<string> exclusions,
	WebGridPagerModes mode,
	string firstText,
	string previousText,
	string nextText,
	string lastText,
	int numericLinksCount,
	Object htmlAttributes
)

Parameters

tableStyle
Type: System.String
The name of the CSS class that is used to style the whole table.
headerStyle
Type: System.String
The name of the CSS class that is used to style the table header.
footerStyle
Type: System.String
The name of the CSS class that is used to style the table footer.
rowStyle
Type: System.String
The name of the CSS class that is used to style each table row.
alternatingRowStyle
Type: System.String
The name of the CSS class that is used to style even-numbered table rows.
selectedRowStyle
Type: System.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
Type: System.String
The table caption.
displayHeader
Type: System.Boolean
true to display the table header; otherwise, false. The default is true.
fillEmptyRows
Type: System.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
Type: System.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
Type: System.Collections.Generic.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
Type: System.Collections.Generic.IEnumerable<String>
A collection that contains the names of the data columns to exclude when the grid auto-populates columns.
mode
Type: System.Web.Helpers.WebGridPagerModes
A bitwise combination of the enumeration values that specify methods that are provided for moving between pages of the WebGrid instance.
firstText
Type: System.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
Type: System.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
Type: System.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
Type: System.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
Type: System.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
Type: System.Object
An object that represents a collection of attributes (names and values) to set for the HTML table element that represents the WebGrid instance.

Return Value

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

  • Medium trust for the immediate caller. This member can be used by partially trusted code.
Show: