Speed up development with full-stack environments for every branch.

Learn More

ASP.net How to use FormView [WebControls]

1902 Runs 7951 Views 2061 Copies
Saved

Saved

invincibleideas 20

invincibleideas
published 4 years ago

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
     <title>ASP.net How to use Formview</title>
    <style type="text/css">        
        div
        {
            margin: 5px;
        }        
        
        #tblEmployeeDetail
        {
            font-family:Arial, Verdana, Sans-Serif;
            font-size:12px;
        }
        
        #tblEmployeeDetail td
        {
             text-align:left;
             border:solid 1px #0066CC;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <fieldset>
            <h2>How to Use FormView Control</h2>
            <asp:FormView ID="fvEmployeeDetail" runat="server">
                <HeaderTemplate>
                    <div><h3>Employee Information</h3></div>
                </HeaderTemplate>
                <ItemTemplate>
                    <table id="tblEmployeeDetail" border="0" cellpadding="10" cellspacing="0">
                       <tr>
                            <td style="width:100px">
                                First Name:
                            </td>
                            <td style="width:250px">
                                <strong><%# Eval("FirstName") %></strong>
                            </td>                            
                            <td style="width:100px">
                                Last Name:
                            </td>
                            <td style="width:250px">
                                <strong><%# Eval("LastName") %></strong>
                            </td>                            
                        </tr>
                        <tr>
                            <td>
                                Home Phone:
                            </td>
                            <td>
                                <strong><%# Eval("HomePhone") %></strong>
                            </td>                            
                            <td>
                                Cell Phone:
                            </td>
                            <td>
                               <strong><%# Eval("CellPhone") %></strong>
                            </td>                            
                        </tr>
                        <tr>
                            <td>
                                Address:
                            </td>
                            <td colspan="3">
                                <strong><%# Eval("Address") %></strong>
                            </td>                                                        
                        </tr>                        
                        <tr>
                            <td>
                                City:
                            </td>
                            <td>
                                <strong><%# Eval("City") %></strong>
                            </td>                            
                            <td>
                                Zipcode:
                            </td>
                            <td>
                                <strong><%# Eval("Zipcode")%></strong>
                            </td>                                                        
                        </tr>
                        <tr>
                            <td>
                                State:
                            </td>
                            <td>
                                <strong><%# Eval("State") %></strong>
                            </td>                            
                            <td>
                                Country:
                            </td>
                            <td>
                                <strong><%# Eval("Country") %></strong>
                            </td>
                        </tr>
                    </table>                    
                </ItemTemplate>                
            </asp:FormView>

        </fieldset>
    </div>
    </form>
</body>
</html>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).