DetailsView autogeneraterows property
The AutoGenerateRows property of the detailsView control specifies that the row of fields from a data source should be generated automatically. If the AutoGenerateRows property value is set to true, the detailsView control displays row of fields for each record in the data source automatically.
If we do not want to display all the fields retrieved from the data source, we set the AutoGenerateRows property value to false. In this case, we need to declare boundfield elements or TemplateField elements which corresponds to the fields to be displayed in the DetailsView control.
The following code demonstrates how to use AutoGenerateRows property in a DetailsView control. We have set the AutoGenerateRows property to true. All the fields in the sample table are displayed in the DetailsView control.
If we do not want to display all the fields retrieved from the data source, we set the AutoGenerateRows property value to false. In this case, we need to declare boundfield elements or TemplateField elements which corresponds to the fields to be displayed in the DetailsView control.
The following code demonstrates how to use AutoGenerateRows property in a DetailsView control. We have set the AutoGenerateRows property to true. All the fields in the sample table are displayed in the DetailsView control.
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="true" AllowPaging="true" DataKeyNames="Code" DataSourceID="MyDataSource" AutoGenerateInsertButton="true" AutoGenerateEditButton="true"> </asp:DetailsView> <asp:SqlDataSource ID="MyDataSource" ConnectionString="<%$Connectionstrings:ERPConnectionString%>" SelectCommand="SELECT * FROM Sample" UpdateCommand="Update SAMPLE SET Name=@Name,description=@description Where Code=@Code" DeleteCommand="Delete SAMPLE Where Code=@Code" InsertCommand="Insert SAMPLE(Code,Name,description) VALUES(@Code,@Name,@description)" runat="server"/>

DetailsView Articles
- Difference between DetailsView and FormView control
- DataBinding a DetailsView control
- GridView and DetailsView Master/Detail page using SqlDataSource control
- GridView and DetailsView master detail page using ObjectDataSource control
- DropDownList and GridView Master/Detail page using ObjectDataSource control
- DetailsView databound event
- DetailsView integer type conversion error?
- Using detailsview control datakeynames property
- How to get the datakey value in DetailsView control
- DetailsView fields
- Formatting DetailsView control with style properties
- Using Boundfields in DetailsView control
- Display message using EmptyDataTemplate in the DetailsView Control
- How to access DetailsView's fields programmatically
- Bind a DetailsView control with a DropDownList control
- Using Command buttons in DetailsView control
- Using Commandfield element in a DetailsView control
- Using buttonfield in a DetailsView control
Most Viewed
Azure Q & A
Azure Platform
Grid-View
GridView CommandField example
Details-View
GridView and DetailsView Master/Detail page using SqlDataSource control
POCO
POCO overview and advantages - POCO class, Entity Framework in Enterprise Applications
Entity Framework
Query entity data model using linq to entities
Array List
Difference between arraylist and list collection
Web Services
How to create a Web service using Visual Studio.net
Form-View
FormView DataBound Event
Object Oriented Programming
Calling base class constructor in C#
Linq
Convert a sequence to a generic list using ToList()method
ERP
ERP Software Development
Project Ideas
Project ideas for students
AccountingSoftware
Accounting Software
MVC
Creating an ASP.Net MVC 3 application
.Net
Using assemblies in .net applications
ASP .Net
How to implement form validation using ASP.Net 2.0 Validation Controls