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

    
<div class="result-wrap">
       <div class="result-title">
                <b>通知类别</b>
        </div>

       <table class="table">
         <tr>
         <th width=150px>新建类别</th>
         <td>
          <asp:TextBox ID="catname" ValidationGroup="vg_catname" CssClass="form-control"  runat="server"></asp:TextBox>
          <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="vg_catname" ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="catname"></asp:RequiredFieldValidator>

         </td>
        </tr>
        
        <tr>
        <th>顺序序号</th>
        <td>
        <asp:TextBox ID="orderid" ValidationGroup="vg_catname" CssClass="form-control" runat="server" Text="0"></asp:TextBox> 
        
        </td>
        </tr>

        <tr>
        <td colspan="2">
        
        <div class="btnc">
        

    <asp:Button ID="Button1" ValidationGroup="vg_catname" CssClass="btn btn-primary" runat="server" Text="添加" onclick="Button1_Click"   />


   

        </div>
        </td>
        
        </tr>

        </table>

 
  

    <asp:GridView ID="GridView1" AutoGenerateColumns="False"  
    DataKeyNames="catid" runat="server"  CssClass="table"  GridLines="None" 
    DataSourceID="sds">
    
    <Columns>
  
    
     
    <asp:BoundField DataField="catid"  ReadOnly="true"  HeaderText="ID" HeaderStyle-Width="90px" InsertVisible="False" SortExpression="catid" > 
 
        </asp:BoundField>
    <asp:BoundField DataField="catname"   HeaderText="通知类别"   SortExpression="catname">
 
        </asp:BoundField>
    <asp:BoundField DataField="orderid"   HeaderText="顺序ID"  HeaderStyle-Width="100px" SortExpression="orderid" >
 
        </asp:BoundField>
   <asp:BoundField DataField="username" HeaderText="最后操作"  ReadOnly="true"    SortExpression="username" HeaderStyle-Width="160px" >

        
        </asp:BoundField>

    <asp:CommandField HeaderStyle-Width="150" HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />

         <asp:BoundField DataField="visible" HeaderText="visible"  Visible="false" SortExpression="visible" />
    </Columns>
      
    </asp:GridView>



    <asp:SqlDataSource ID="sds" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
         DeleteCommand="DELETE FROM [Portal_Announcementscat] WHERE [catid] = @catid" 
         SelectCommand="SELECT [catid], [catname], [orderid], [username], [visible] FROM [Portal_Announcementscat] ORDER BY [orderid]" 
         UpdateCommand="UPDATE [Portal_Announcementscat] SET [catname] = @catname, [orderid] = @orderid, [username] = @username  WHERE [catid] = @catid" OnSelecting="sds_Selecting" OnUpdating="sds_Updating"
     
    >
    
   
   
   
   <UpdateParameters>
       <asp:Parameter   Name="catname" Type="String" />
       <asp:Parameter    Name="orderid" Type="Int32" />
       <asp:Parameter Name="username" Type="String" />
       <asp:Parameter Name="visible" Type="Int32" />
       <asp:Parameter    Name="catid" Type="Int32" />
   </UpdateParameters>
    
    
    <DeleteParameters>
    <asp:Parameter Name="catid" Type="Int32"  />
    </DeleteParameters>
    
    </asp:SqlDataSource>





   </div>
</asp:Content>
