











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the detailsview and formview controls in asp.net, explaining their similarities and differences in displaying and editing single records. It covers their characteristics, usage, and configuration with examples.
Typology: Slides
1 / 19
This page cannot be seen from the preview
Don't miss anything!












Use the DetailsView control to Display a single record at a time Insert, edit, and delete records
Basically, the
Just by binding the DetailsView to a DataSource, you get basic selection and editing capabilities See DetailsViewExample
If the AutoGenerateFields property is true, the fields will be created automatically If not, you need to create each field manually
Take a look at the Field Editor (fields have different types) The following are used to create visible controls to display bound data (Set the DataField property BoundField CheckBoxField HyperLinkField ImageField ButtonField
Use the CommandField to display automatically wired buttons ShowDeleteButton ShowInsertButton ShowEditButton
Example: <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
Like the GridView The DataKeyNames property must define a record key The data source must be set up for updates Create CommandFields for the Insert, Update, and Delete buttons See DetailsViewExample2.aspx
You have two choices for field layout Use what the DetailsView provides Create a Template field and define the following three templates
ItemTemplate appears while a record is NOT being edited or deleted InsertItemTemplate appears while a record is being inserted EditItemTemplate appears while a record is being header EmptyDataTemplate appears when there are no records
HeaderTemplate is the header row at the top It can contain any html or ASP controls. FooterTemplate is the footer row at the bottom The same is true here
For each template, you define the bound controls that will display the data, along with the formatting