<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/News.master" AutoEventWireup="true" CodeBehind="News_Cat.aspx.cs" Inherits="helpdesk.helpdesk.News_Cat" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">


    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>


    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
     ConnectionString='<%$ ConnectionStrings:connectionstring %>' 
        DeleteCommand="DELETE FROM [helpdesk_newscat] WHERE [id] = @id" 
        InsertCommand="INSERT INTO [helpdesk_newscat] ([catname]) VALUES (@catname)" 
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT * FROM [helpdesk_newscat]" UpdateCommand="UPDATE [helpdesk_newscat] SET [catname] = @catname WHERE [id] = @id"
    
    >
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="catname" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>




    <br />
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="id" DataSourceID="SqlDataSource1" DefaultMode="Insert" 
        Height="50px" Width="600px"  GridLines="None">
        <Fields>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="catname" HeaderText="分类名" 
                SortExpression="catname"  HeaderStyle-Width="100px"   ItemStyle-Width="450px" />
            <asp:CommandField ShowInsertButton="True" InsertText="添加" CancelText="取消" />
        </Fields>
         
        
        
    </asp:DetailsView>
    
    
    
    <br /><br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  Width="800px"
        DataKeyNames="id" DataSourceID="SqlDataSource1"  GridLines="None" CssClass="table table-hover">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" EditText="编辑" UpdateText="更新" CancelText="取消" DeleteText="删除" ShowEditButton="True"   HeaderStyle-Width="80px"/>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id"  HeaderStyle-Width="80px" />
            <asp:BoundField DataField="catname" HeaderText="类别名" 
                SortExpression="catname"   />
        </Columns>
        
         
    
    </asp:GridView>

 

    
        </ContentTemplate>

    </asp:UpdatePanel>


</asp:Content>
