What are GridView and ListView in ASP.NET?

 Posted by Tripati_tutu on 10/15/2010 | Category: ASP.NET Interview questions | Views: 14391 | Points: 40

Grid View:

The grid view control is a powerful data grid control that allows you to display an entire collection of data, and sorting, and paging, and perform inline editing.

• DataGrid requires you to write custom code for handling common operations like sorting, paging and manipulation of data in DataGrid.

• DataGrid when bound to DataSource control can only support select operation on DataSource. Updating DataSource through DataGrid can be done only through custom ADO.NET code.

• DataGrid supports a restricted event model.

• DataGrid does not support adaptive rendering on different platforms.

Features of Grid View:

• Enhanced data source binding capabilities (Direct interaction with DataSource without any ADO.NET code)
• Built-in support for sorting and paging functionality
• Improved Design time features(Smart Panel Tag)
• Customized pager user interface with Pager Template property
• Additional Column types(Image Field)
• New Event model which support for pre-event and post-event operations

List View:

ListView is a new databound control. ListView control is similar to GridView, Repeater, and DataList which helps us to display a table of data with some additional features. The list view control is basically an advanced ListBox control which allows you to add rows of data, but it also supports large and small icons, multiple columns, automatic label edit, column re-order, hot-tracking. ListView control can be a hybrid control between GridView and Repeater control. ListView control gives us more control on the rendered HTML output with edit/update/delete feature. Also, ListView control has a built in support for adding new row, sorting, etc.

The four main modes of ListView control are:

Icon - Displays items with large icons and your main text
Small Icon - Displays items with small icons and your main text
List - Displays items with your main text
Detail - Displays items with small icons, your main text, and any other data to be displayed in columns and much more...

Features of List View:
• Can define its own template/Layout/Structure for the data display.
• Edit/Update/Delete capabilities on the data displayed.
• Built-in support for inserting new row.
• Built-in support for sorting
• Supports databinding via DataSource Controls including LINQ DataSource controls.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response