What is the major difference between GridView/DetailsView/FormView in ASP.net [closed]

你说的曾经没有我的故事 提交于 2019-12-07 03:16:33

问题


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?


回答1:


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.




回答2:


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.




回答3:


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)




回答4:


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.




回答5:


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




回答6:


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.




回答7:


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..



来源:https://stackoverflow.com/questions/395968/what-is-the-major-difference-between-gridview-detailsview-formview-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!