<%@ Page Language="C#" MasterPageFile="~/BlogerMasterPage.master" AutoEventWireup="true" CodeFile="LinkManage.aspx.cs" Inherits="Bloger_BlogManage_LinkManage" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width: 566px; height: 270px">
        <tr>
            <td align="right" style="width: 31px; height: 20px">
            </td>
            <td align="left" style="width: 1px; height: 20px">
                <asp:Label ID="Label3" runat="server" Width="436px"></asp:Label></td>
        </tr>
        <tr>
            <td align="right" style="width: 31px">
                <asp:Label ID="Label1" runat="server" Text="友站管理" Width="98px"></asp:Label></td>
            <td align="left" style="width: 1px">
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2" style="height: 1px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 31px; height: 167px">
            </td>
            <td align="left" style="width: 1px; height: 167px">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="link_id"
        DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None" Height="10px" Width="362px" AllowPaging="True" EmptyDataText="暂无友站" PageSize="8">
        <Columns>
            <asp:BoundField DataField="link_id" HeaderText="link_id" InsertVisible="False" ReadOnly="True"
                SortExpression="link_id" Visible="False" />
            <asp:TemplateField HeaderText="友站名称" SortExpression="link_name">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("link_name") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="友站名称不能为空" Style="position: static" ValidationGroup="tt"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("link_name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="友站地址" SortExpression="link_url">
                <EditItemTemplate>
                    &nbsp;<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("link_url") %>'></asp:TextBox><br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox2"
                        ErrorMessage="友站地址不能为空" Style="position: static" ValidationGroup="tt"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("link_url") %>'></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="更新" ValidationGroup="tt"></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>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                        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="right" style="width: 31px">
                <asp:Label ID="Label2" runat="server" Text="添加友情站点" Width="110px"></asp:Label></td>
            <td align="left" style="width: 1px">
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2" style="height: 2px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 31px">
            </td>
            <td align="left" style="width: 1px">
                <br />
                <table style="width: 323px; height: 90px">
                    <tr>
                        <td style="width: 100px; height: 29px;">
                            <asp:Label ID="Label4" runat="server" Text="友站名称："></asp:Label></td>
                        <td colspan="2" style="width: 215px; height: 29px">
                            <asp:TextBox ID="TextBox1" runat="server" Height="22px" Width="203px"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                ErrorMessage="友站名称不能为空" Style="position: static" ValidationGroup="aa"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label5" runat="server" Text="友站地址："></asp:Label></td>
                        <td colspan="2" style="width: 215px">
                            <asp:TextBox ID="TextBox2" runat="server" Height="19px" Width="203px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                                ErrorMessage="友站地址不能为空" Height="8px" Style="position: static" ValidationGroup="aa"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                        </td>
                        <td colspan="2" style="width: 215px">
                            <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click" ValidationGroup="aa">添加友站</asp:LinkButton></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <br />
    &nbsp;<br />
    <br />
    <br />
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_link] WHERE [link_id] = @original_link_id"
        InsertCommand="INSERT INTO [DE_link] ([link_name], [link_url], [bloger_name]) VALUES (@link_name, @link_url, @bloger_name)"
        OldValuesParameterFormatString="original_{0}" OnInserting="SqlDataSource1_Inserting"
        OnSelecting="SqlDataSource1_Selecting" SelectCommand="SELECT * FROM [DE_link] WHERE ([bloger_name] = @bloger_name)"
        UpdateCommand="UPDATE [DE_link] SET [link_name] = @link_name, [link_url] = @link_url WHERE [link_id] = @original_link_id">
        <DeleteParameters>
            <asp:Parameter Name="original_link_id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="link_name" Type="String" />
            <asp:Parameter Name="link_url" Type="String" />
            <asp:Parameter Name="original_link_id" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:Parameter Name="bloger_name" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="link_name" Type="String" />
            <asp:Parameter Name="link_url" Type="String" />
            <asp:Parameter Name="bloger_name" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
</asp:Content>

