What is the difference between gridview and dataview
Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services.
Privacy policy. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. These column types meet the needs of most common scenarios, but are also easier to extend or replace than the column types in the DataGrid control. Multiple ways to display data The DataGrid control is limited to displaying data from an external data source.
The DataGridView control, however, can display unbound data stored in the control, data from a bound data source, or bound and unbound data together. You can also implement virtual mode in the DataGridView control to provide custom data management.
Multiple ways to customize the display of data The DataGridView control provides many properties and events that enable you to specify how data is formatted and displayed. For example, you can change the appearance of cells, rows, and columns depending on the data they contain, or you can replace data of one data type with equivalent data of another type. The GridView control supports a DataSourceID property that takes any object that implements the IDataSource interface and can, therefore, take advantage of the data source control's sorting, paging, updating, and deleting capabilities, for example, the SqlDataSource control.
The DataGrid control requires additional coding for paging. The GridView control automatically supports paging by setting the PagerSettings property. The GridView control's PagerStyle property can be used to set styles and the position of the pager. Additionally, you can customize the pager buttons for the GridView control using a PagerTemplate. Custom paging support in the GridView is supplied by the bound data source control as opposed to the AllowCustomPaging mechanism supplied by the DataGrid control.
The DataGrid and the GridView controls have different event models. The DataGrid control raises single events for operations, while the GridView control is capable of both pre-operation and post-operation events. The GridView control supports the Sorting event that occurs when a field is sorted.
Note that this sorting event occurs before the GridView control automatically handles the sort operation, giving you the opportunity to examine or change the SortExpression property, or cancel this operation by setting the Cancel property to true on the passed event arguments. The GridView control supports the Sorted event that occurs after the GridView control completes the sort operation, giving you the opportunity to change or format the result of the sort operation.
In comparison, the DataGrid control supports the SortCommand event that occurs when a column is sorted. Training Schedules. Have Queries? Live Training Schedules. We use cookies to make interactions with our websites and services easy and meaningful. Please read our Privacy Policy for more details. Remember me Forgot Password? Login Please Wait Sign in with Facebook.
0コメント