What is the purpose of detailsview control and how does it relate to templatefield?

Bob Dang 1 Reputation point
2022-04-21T07:30:41.373+00:00

What is the purpose of detailsview control and how does it relate to templatefield?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,247 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,066 Reputation points
    2022-04-22T06:29:49.79+00:00

    Hi @Bob Dang ,
    The DetailView is a data control. Of course the purpose is to show the data from the data source. You could try to bind the source to see the layout. It only show one single record. When you bind the datafield, there are two ways: one is using BoundField. Because the detailview have the table layout, you only bind the DataField on the BoundField. Another way is using the templatedfiled. You could create the template by yourself. I suggest you could learn this article.

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Bob Dang 1 Reputation point
    2022-04-22T06:40:39.143+00:00

    195436-image.png

    What is a data control in the highlighted image? What do you mean by it only shows one single record in the highlighted part of the image, since I thought that it can show many records? What do you mean by you can only bind the datafield on boundfield?

    Thanks for your help.