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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>" 
            DeleteCommand="DELETE FROM [Admins] WHERE [AdminID] = @AdminID" 
            InsertCommand="INSERT INTO [Admins] ([AdminName], [Password], [sex], [department]) 
                           VALUES (@AdminName, @Password, @sex, @department)" 
            SelectCommand="SELECT * FROM [Admins]" 
            UpdateCommand="UPDATE [Admins] SET [AdminName] = @AdminName, [Password] = @Password, 
                           [sex] = @sex, [department] = @department WHERE [AdminID] = @AdminID">
            <DeleteParameters>
                <asp:Parameter Name="AdminID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="AdminName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="sex" Type="String" />
                <asp:Parameter Name="department" Type="String" />
                <asp:Parameter Name="AdminID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="AdminName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="sex" Type="String" />
                <asp:Parameter Name="department" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
            DataKeyNames="AdminID" DataSourceID="SqlDataSource1" CellPadding="4" 
            ForeColor="#333333" BackColor="#FF9900" BorderStyle="Double" 
            Height="186px" Width="344px">
            <PagerStyle ForeColor="#333333" HorizontalAlign="Center" 
                BackColor="#FFCC66" />     
                      
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderTemplate>用户基本信息</HeaderTemplate>
            
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <EditItemTemplate>
                用户编号:
                <asp:Label ID="AdminIDLabel1" runat="server" Text='<%# Eval("AdminID") %>' />
                <br />
                用户名:
                <asp:TextBox ID="AdminNameTextBox" runat="server" 
                    Text='<%# Bind("AdminName") %>' />
                <br />
                登录密码:
                <asp:TextBox ID="PasswordTextBox" runat="server" 
                    Text='<%# Bind("Password") %>' />
                <br />
                性&nbsp;&nbsp;&nbsp; 别:
                <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />
                <br />
                所属部门:
                <asp:TextBox ID="departmentTextBox" runat="server" 
                    Text='<%# Bind("department") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="更新" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </EditItemTemplate>
            <InsertItemTemplate>
                用户名:
                <asp:TextBox ID="AdminNameTextBox" runat="server" 
                    Text='<%# Bind("AdminName") %>' />
                <br />
               登录密码:
                <asp:TextBox ID="PasswordTextBox" runat="server" 
                    Text='<%# Bind("Password") %>' />
                <br />
                性&nbsp;&nbsp;&nbsp; 别:
                <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />
                <br />
                所属部门:
                <asp:TextBox ID="departmentTextBox" runat="server" 
                    Text='<%# Bind("department") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="插入" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </InsertItemTemplate>
            <ItemTemplate>
                用户编号:
                <asp:Label ID="AdminIDLabel" runat="server" Text='<%# Eval("AdminID") %>' />
                <br />
                用户名:
                <asp:Label ID="AdminNameLabel" runat="server" Text='<%# Bind("AdminName") %>' />
                <br />
                登录密码:
                <asp:Label ID="PasswordLabel" runat="server" Text='<%# Bind("Password") %>' />
                <br />
                性&nbsp;&nbsp;&nbsp; 别:
                <asp:Label ID="sexLabel" runat="server" Text='<%# Bind("sex") %>' />
                <br />
                所属部门:
                <asp:Label ID="departmentLabel" runat="server" 
                    Text='<%# Bind("department") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="编辑" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="删除" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="新建" />
            </ItemTemplate>
        </asp:FormView>
    
    </div>
    </form>
</body>
</html>
