WebGrid(IEnumerable<Object>, IEnumerable<String>, String, Int32, Boolean, Boolean, String, String, String, String, String, String, String) WebGrid(IEnumerable<Object>, IEnumerable<String>, String, Int32, Boolean, Boolean, String, String, String, String, String, String, String) WebGrid(IEnumerable<Object>, IEnumerable<String>, String, Int32, Boolean, Boolean, String, String, String, String, String, String, String) Constructor

Definition

Initializes a new instance of the WebGrid class.

public WebGrid (System.Collections.Generic.IEnumerable<dynamic> source = null, System.Collections.Generic.IEnumerable<string> columnNames = null, string defaultSort = null, int rowsPerPage = 10, bool canPage = true, bool canSort = true, string ajaxUpdateContainerId = null, string ajaxUpdateCallback = null, string fieldNamePrefix = null, string pageFieldName = null, string selectionFieldName = null, string sortFieldName = null, string sortDirectionFieldName = null);
new System.Web.Helpers.WebGrid : seq<obj> * seq<string> * string * int * bool * bool * string * string * string * string * string * string * string -> System.Web.Helpers.WebGrid
Public Sub New (Optional source As IEnumerable(Of Object) = null, Optional columnNames As IEnumerable(Of String) = null, Optional defaultSort As String = null, Optional rowsPerPage As Integer = 10, Optional canPage As Boolean = true, Optional canSort As Boolean = true, Optional ajaxUpdateContainerId As String = null, Optional ajaxUpdateCallback As String = null, Optional fieldNamePrefix As String = null, Optional pageFieldName As String = null, Optional selectionFieldName As String = null, Optional sortFieldName As String = null, Optional sortDirectionFieldName As String = null)
Parameters
source
IEnumerable<Object>

The data to display.

columnNames
IEnumerable<String>

A collection that contains the names of the data columns to display. By default, this value is auto-populated according to the values in the source parameter.

defaultSort
String String String

The name of the data column that is used to sort the grid by default.

rowsPerPage
Int32 Int32 Int32

The number of rows that are displayed on each page of the grid when paging is enabled. The default is 10.

canPage
Boolean Boolean Boolean

true to specify that paging is enabled for the WebGrid instance; otherwise false. The default is true.

canSort
Boolean Boolean Boolean

true to specify that sorting is enabled for the WebGrid instance; otherwise, false. The default is true.

ajaxUpdateContainerId
String String String

The value of the HTML id attribute that is used to mark the HTML element that gets dynamic Ajax updates that are associated with the WebGrid instance.

ajaxUpdateCallback
String String String

The name of the JavaScript function that is called after the HTML element specified by the AjaxUpdateContainerId property has been updated. If the name of a function is not provided, no function will be called. If the specified function does not exist, a JavaScript error will occur if it is invoked.

fieldNamePrefix
String String String

The prefix that is applied to all query-string fields that are associated with the WebGrid instance. This value is used in order to support multiple WebGrid instances on the same web page.

pageFieldName
String String String

The name of the query-string field that is used to specify the current page of the WebGrid instance.

selectionFieldName
String String String

The name of the query-string field that is used to specify the currently selected row of the WebGrid instance.

sortFieldName
String String String

The name of the query-string field that is used to specify the name of the data column that the WebGrid instance is sorted by.

sortDirectionFieldName
String String String

The name of the query-string field that is used to specify the direction in which the WebGrid instance is sorted.

Applies to