<%@ Page Language="C#" MasterPageFile="~/AdminMasterPage.master" AutoEventWireup="true" CodeFile="CollegeManage.aspx.cs" Inherits="Admin_CollegeManage" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width: 571px; height: 322px">
        <tr>
            <td align="left" style="width: 29px; height: 28px">
            </td>
            <td align="left" style="width: 90px; height: 28px">
            </td>
            <td align="left" style="width: 100px; height: 28px">
            </td>
        </tr>
        <tr>
            <td align="left" style="width: 29px; height: 41px">
            </td>
            <td align="left" style="width: 90px; height: 41px">
                <asp:Label ID="Label1" runat="server" Text="院系管理"></asp:Label></td>
            <td align="left" style="width: 100px; height: 41px">
            </td>
        </tr>
        <tr>
            <td colspan="1" style="width: 29px; height: 1px">
            </td>
            <td colspan="2" style="height: 1px">
                <hr />
            </td>
        </tr>
        <tr>
            <td style="width: 29px; height: 198px">
            </td>
            <td style="width: 90px; height: 198px">
            </td>
            <td align="left" style="height: 198px" valign="top">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="college_id"
        DataSourceID="SqlDataSource1" AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None" PageSize="8" Height="10px" Width="278px" OnSelectedIndexChanging="GridView1_SelectedIndexChanging">
        <Columns>
            <asp:TemplateField HeaderText="college_id" InsertVisible="False" SortExpression="college_id"
                Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("college_id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("college_id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="院系名称" SortExpression="college_name">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("college_name") %>'></asp:TextBox><br />
                    <table style="width: 168px">
                        <tr>
                            <td style="width: 69px; height: 19px">
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                    ErrorMessage="院系名称不能为空" Height="16px" Style="position: static" ValidationGroup="aa"
                                    Width="134px"></asp:RequiredFieldValidator></td>
                        </tr>
                    </table>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("college_name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="bloger_count" HeaderText="bloger_count" SortExpression="bloger_count"
                Visible="False" />
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="更新" OnClick="LinkButton1_Click" ValidationGroup="aa"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton>
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                </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" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="left" style="width: 29px; height: 13px">
            </td>
            <td align="left" style="width: 90px; height: 13px">
                <asp:Label ID="Label2" runat="server" Text="添加新院系"></asp:Label></td>
            <td align="left" style="width: 100px; height: 13px">
            </td>
        </tr>
        <tr>
            <td align="left" colspan="1" style="width: 29px; height: 1px">
            </td>
            <td align="left" colspan="2" style="height: 1px">
                <hr />
            </td>
        </tr>
        <tr>
            <td style="width: 29px">
            </td>
            <td style="width: 90px">
            </td>
            <td align="left" style="width: 100px" valign="top">
                &nbsp;<table style="width: 259px; height: 55px">
        <tr>
            <td style="width: 66px" valign="top">
                <asp:Label ID="Label3" runat="server" Text="院系名称："></asp:Label></td>
            <td style="width: 81px">
                <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" ValidationGroup="c"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox1"
                    ErrorMessage="院系名称不能为空" ValidationGroup="c" Width="104px"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td style="width: 66px; height: 23px;">
            </td>
            <td style="width: 81px; height: 23px;">
                <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click" Width="122px" ValidationGroup="c">添加新院系</asp:LinkButton></td>
        </tr>
    </table>
            </td>
        </tr>
    </table>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_college] WHERE [college_id] = @original_college_id"
        InsertCommand="INSERT INTO [DE_college] ([college_name], [bloger_count]) VALUES (@college_name, default)"
        OldValuesParameterFormatString="original_{0}" OnInserting="SqlDataSource1_Inserting"
        SelectCommand="SELECT * FROM [DE_college] WHERE college_name <> '其他'" UpdateCommand="UPDATE [DE_college] SET [college_name] = @college_name WHERE [college_id] = @original_college_id" OnUpdating="SqlDataSource1_Updating">
        <DeleteParameters>
            <asp:Parameter Name="original_college_id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="college_name" Type="String" />
            <asp:Parameter Name="original_college_id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="college_name" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

