Question

What are the similarities and differences between GridView, DetailView, FormView?

What are use case scenarios for when you would use each of these controls and why?

Was it helpful?

Solution

GridView shows them all like an HTML table. If you click on a key in a row, DetailView shows the details for the row in a separate space. If you need to insert a new row, FormView appears also in a separate space.

OTHER TIPS

Formview is intended for insert/update/view of a single record.

DetailsView is intended for the displaying of a single record with optional support for paging and navigation.

GridView is intended to primarily to display/update multiple records. It's considered a replacement for the DataGrid control from .NET 1.1.

Well, I'd read the ASP.Net QuickStart Tutorials which give a good overview of each control:

ASP.NET Quickstart Tutorials

If you're displaying "tabular" data, then you're probably going to use DetailsView as it's designed for master-detail relationships and has tabular rendering built-in (FormsView does not)

GridView supports editing. You can use commands edit, update, delete, in ButtonField, ImageButton, Hyperlink etc. used as a template. In addition if we specify autogenerate deletebutton, autogenerate editbutton properties of GridView it will add the columns for it.

Form view is data bound it is user interface control, but details view has a build in tabular rendering

Form View:Form view control enable us to view single record at a time. And we can customize the page depends upon your requirement and place more control over the layout.

Details View:Details View also view single record at a time. And details view result its like HTML table.

Gridview is use to view data only, we can't do any modification (editing or inserting is not possible).

Dataview is use to view, edit or insert data.dataview has built in tabular rendering.it will generate them for you in a straight top to down list with no possibility of moving them around to make them more user friendly.

In formview, you can position the element wherever you want them on the page.it means formview provide user define template for its rendering..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top