The following example demonstrates how to use a FormView control to display the values from a SqlDataSource control. Visual Basic <%@ Page language="VB" %> FormView Example

FormView Example

<%# Eval("FirstName") %> <%# Eval("LastName") %>

<%# Eval("Title") %>
C# <%@ Page language="C#" %> FormView Example

FormView Example

<%# Eval("FirstName") %> <%# Eval("LastName") %>

<%# Eval("Title") %>
The following example demonstrates how to use a FormView control to edit existing records. Security Note: The control in this example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview. Visual Basic <%@ Page language="VB" %> FormView Example

FormView Example

 
Name: <%# Eval("FirstName") %> <%# Eval("LastName") %>
Title: <%# Eval("Title") %>
Hire Date: <%# Eval("HireDate","{0:d}") %>
Address: <%# Eval("Address") %>
<%# Eval("City") %> <%# Eval("Region") %> <%# Eval("PostalCode") %>
<%# Eval("Country") %>
 
Name:
Title:
Hire Date:
Address:



C# <%@ Page language="C#" %> FormView Example

FormView Example

 
Name: <%# Eval("FirstName") %> <%# Eval("LastName") %>
Title: <%# Eval("Title") %>
Hire Date: <%# Eval("HireDate","{0:d}") %>
Address: <%# Eval("Address") %>
<%# Eval("City") %> <%# Eval("Region") %> <%# Eval("PostalCode") %>
<%# Eval("Country") %>
 
Name:
Title:
Hire Date:
Address:



The following example demonstrates how to use a FormView control to insert new records. Security Note: The control in this example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview. Visual Basic <%@ Page language="VB" %> FormView InsertItemTemplate Example

FormView InsertItemTemplate Example

 
Name: <%# Eval("FirstName") %> <%# Eval("LastName") %>
Title: <%# Eval("Title") %>
 
:
: