|
ASP.NET Book
The online ASP.NET Tutorial Book |
|||||||||
|
|
|||||||||
ASP.NET BasicsHTML BasicsASP.NET Web Server Advanced HTML Application Designing Using Visual Studio ASP.NET Standards ASP.NET Styling ASP.NET Navigation ASP.NET TipsASP.NET ValidationHTML forms CSS Styling CSS Advanced ASP.NET Features ASP.NET Image Effects Common mistakes DB Design tips Building ApplicationsDesign Secure AppsBuild Secure Apps |
4.4 The FormView Control |
||||||||
|
The “FormView” control is similar to the “DetailsView” control. The only difference is instead of rendering data as an HTML table, the “FormView” control uses templates that let you specify exactly how you want it to render the data. The following template choices are available for you in the “FormView” control:
The following sample code shows how you can display the data from the data source using the Eval method. Here a label is associated to a data-source field called lblName. <asp:Label ID="lblName" runat="server" Text='<%# Eval("lastname") %>'/> The following sample code shows how to bind a text box to the “lblName” field. Here the “Bind” is used instead of “Eval” as the binding should be two ways; for input and output. A command button can also be associated within a template.
Table of ContentsChapter 1 - The Code-Behind Model [top] |
|||||||||