<%@ Page Language="C#" MasterPageFile="~/BlogerMasterPage.master" AutoEventWireup="true" CodeFile="CategoryManage.aspx.cs" Inherits="Bloger_LogManage_CategoryManage" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    &nbsp; &nbsp;&nbsp;&nbsp;
    <table style="width: 560px; height: 248px">
        <tr>
            <td align="right" style="width: 51px">
            </td>
            <td align="left" style="width: 196px">
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 51px">
                <asp:Label ID="Label1" runat="server" Text="管理标签" Width="78px"></asp:Label></td>
            <td align="left" style="width: 196px">
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td align="right" colspan="3" style="height: 3px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 51px">
            </td>
            <td align="left" style="width: 196px">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="category_id"
        DataSourceID="SqlDataSource2" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDeleted="GridView1_RowDeleted" OnSelectedIndexChanging="GridView1_SelectedIndexChanging" CellPadding="4" ForeColor="#333333" GridLines="None">
        <Columns>
            <asp:TemplateField HeaderText="category_id" InsertVisible="False" SortExpression="category_id"
                Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("category_id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("category_id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="分类名" SortExpression="分类名">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("category_name") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="分类名不能为空" Style="position: static" ValidationGroup="aa"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("category_name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="bloger_name" HeaderText="bloger_name" SortExpression="bloger_name"
                Visible="False" />
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="更新" OnClick="LinkButton1_Click" ValidationGroup="aa" OnLoad="LinkButton1_Load"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="编辑"></asp:LinkButton>&nbsp;
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="Select"
                        OnClientClick='return confirm("确认删除？")' Text="删除"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <SelectedRowStyle BackColor="#E2DED6" ForeColor="#333333" Font-Bold="True" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
    </asp:GridView>
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 51px; height: 25px">
            </td>
            <td align="left" style="width: 196px; height: 25px">
            </td>
            <td style="width: 100px; height: 25px">
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 51px">
                <asp:Label ID="Label2" runat="server" Text="添加新标签" Width="82px"></asp:Label></td>
            <td align="left" style="width: 196px">
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td align="right" colspan="3" style="height: 2px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 51px">
            </td>
            <td align="left" style="width: 196px">
                &nbsp;<table style="width: 276px; height: 57px">
                    <tr>
                        <td style="width: 65px; height: 30px;">
                            <asp:Label ID="Label3" runat="server" Text="标签名："></asp:Label></td>
                        <td style="width: 100px; height: 30px;">
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                ErrorMessage="标签名不能为空" Style="position: static" ValidationGroup="tt" Width="160px"></asp:RequiredFieldValidator><br />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 65px">
                        </td>
                        <td style="width: 100px">
                            <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click" ValidationGroup="tt">添加新标签</asp:LinkButton></td>
                    </tr>
                </table>
            </td>
            <td style="width: 100px">
            </td>
        </tr>
    </table>
    &nbsp; &nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;<br />
    &nbsp;&nbsp;<br />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_category] WHERE [category_id] = @original_category_id"
        InsertCommand="INSERT INTO [DE_category] ([category_name], [bloger_name]) VALUES (@category_name, @bloger_name)"
        OldValuesParameterFormatString="original_{0}" OnInserting="SqlDataSource2_Inserting"
        SelectCommand="SELECT * FROM [DE_category] WHERE ([bloger_name] = @bloger_name AND [category_name] <> '默认')" UpdateCommand="UPDATE [DE_category] SET [category_name] = @category_name WHERE [category_id] = @original_category_id" OnSelecting="SqlDataSource2_Selecting" OnDeleting="SqlDataSource2_Deleting">
        <DeleteParameters>
            <asp:Parameter Name="original_category_id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="category_name" Type="String" />
            <asp:Parameter Name="original_category_id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="category_name" Type="String" />
            <asp:Parameter Name="bloger_name" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter Name="bloger_name" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    &nbsp; &nbsp;
    &nbsp; &nbsp;
    &nbsp;&nbsp;
</asp:Content>

