<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="dept.aspx.cs" Inherits="Worklog.Admin.dept" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<div id="sm">
部门管理
</div>



    <asp:DetailsView ID="DetailsView1" AutoGenerateRows="false"  runat="server" Height="61px" Width="400px" 
        DataSourceID="SqlDataSource1" DefaultMode="Insert">
        <Fields>
            
             <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="catname" HeaderText="部门名称" 
                SortExpression="catname" />
            <asp:BoundField DataField="orderid" HeaderText="顺序ID" 
                SortExpression="orderid" />
             <asp:CommandField ShowInsertButton="True" />
           
        </Fields>
        
          <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    </asp:DetailsView>
    <br />
    <br />
    <br />
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="id" DataSourceID="SqlDataSource1" Width="500px">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="catname" HeaderText="部门名称" 
                SortExpression="catname" />
            <asp:BoundField DataField="orderid" HeaderText="顺序ID" 
                SortExpression="orderid" />
        </Columns>
        
        
        
  <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    <AlternatingRowStyle BackColor="#F2F2F2" />
      <RowStyle BackColor="#ffffff"  Height="28"/>
     
    
    </asp:GridView>
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    
     ConnectionString='<%$ ConnectionStrings:Connectionstring %>' 
        DeleteCommand="DELETE FROM [users_dept] WHERE [id] = @id" 
        InsertCommand="INSERT INTO [users_dept] ([catname], [orderid]) VALUES (@catname, @orderid)" 
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT [id], [catname], [orderid] FROM [users_dept] ORDER BY [orderid]" UpdateCommand="UPDATE [users_dept] SET [catname] = @catname, [orderid] = @orderid WHERE [id] = @id"
    >
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="orderid" Type="Int32" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="orderid" Type="Int32" DefaultValue="0" />
        </InsertParameters>
    </asp:SqlDataSource>

</div>




</asp:Content>
