<%@ Page Title="友情链接" Language="C#" MasterPageFile="~/Manager/Manger.Master" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="MFrendLick.aspx.cs" Inherits="Stat.web.Manerger.MFrendLick" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">

$(document).ready(function(){
$("input[name$='btnEditSave']").bind('click',checkform);
$("a:contains('删除')").bind('click',affirm);
});

function affirm()
{
  return confirm('确认要删除吗？');
}
function checkform()
{
   var wName= $("input[name$='txtWebName']").val();
   var wUrl= $("input[name$='txtWebUrl']").val();   
    if(!IsNull(wName,1,100)){alert("名称不能够为空！");$("input[name$='txtWebName']").focus(); return false;}
    if(!IsNull(wUrl,1,100)){alert("URL不能够为空！");$("input[name$='txtWebUrl']").focus(); return false;}   
}

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpTop" runat="server">
<div style="margin-top: 5px;">
   当前位置：网站广告 &gt; 友情链接
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpMSG" runat="server">
 <span class="M_b14">小贴士：</span> 你可以管理 友情链接。
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cpMain" runat="server">
<br />
       <table align="left" width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td  valign="top" align="center">
                    <asp:Panel ID="pnWebList" runat="server" BackColor="White" Width="100%">
                        <asp:GridView ID="gvWebList" runat="server" AutoGenerateColumns="False" EmptyDataText="没有找到链接，请添加"
                            GridLines="None" Width="100%" BorderColor="#CEDFEF" BorderWidth="1px" 
                            onrowdatabound="gvWebList_RowDataBound" onrowdeleting="gvWebList_RowDeleting" 
                            onrowediting="gvWebList_RowEditing">
                            <Columns>
                                <asp:BoundField DataField="id" HeaderText="站点ID" SortExpression="WebId">
                                    <HeaderStyle Height="25px" />
                                    <ItemStyle Width="50px" />
                                </asp:BoundField>
                                <asp:BoundField DataField="LinkName" HeaderText="站点名称" 
                                    SortExpression="WebName" >
                                    <ItemStyle HorizontalAlign="Left" Width="150px" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="LinkURL" HeaderText="访问地址" SortExpression="WebUrl" >
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="显示样式">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# ForStyle(Eval("LinkImgPath"),Eval("Style")) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="状态" >
                                    <ItemTemplate >
                                        <asp:Label ID="Label1" runat="server" Text='<%# IsState(Eval("State")) %>'></asp:Label>                                      
                                    </ItemTemplate>
                                    <ItemStyle Width="70px" CssClass="forumRow" />
                                </asp:TemplateField>
                                <asp:ButtonField CommandName="Edit" Text="编辑">
                                    <ItemStyle Width="40px" />
                                </asp:ButtonField>
                                <asp:CommandField ShowDeleteButton="True">
                                    <ItemStyle Width="40px" />
                                </asp:CommandField>
                            </Columns>                            
                            <HeaderStyle BackColor="#E9F1FA" Height="20px" />
                        </asp:GridView>
                       </asp:Panel>
                    <asp:Panel ID="pnEditWeb" runat="server" BackColor="White" Visible="False"
                        Width="100%">
                        <table bgcolor="#cedfef" border="0" cellpadding="0" cellspacing="1" class="padding" width="100%">
                            <tr>
                                <td  colspan="2" style="height: 26px" bgcolor="#e9f1fa" height="25">
                                    <strong><span style="font-size: 12pt">
                                    添加/修改友情链接</span></strong></td>
                            </tr>
                            <tr>
                                <td style="width: 165px; height: 25px; text-align: right" bgcolor="#FFFFFF">
                                    网站名称：</td>
                                <td style="width: 512px; height: 25px; text-align: left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtWebName" runat="server" Width="150px"></asp:TextBox>
                                    </td>
                            </tr>
                            <tr style="color: #000000">
                                <td style="width: 165px; height: 26px; text-align: right" bgcolor="#FFFFFF">
                                    网站地址：</td>
                                <td style="width: 512px; height: 26px; text-align: left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtWebUrl" runat="server" Width="250px"></asp:TextBox>
                                    </td>
                            </tr>
                            <tr style="color: #000000">
                                <td bgcolor="#FFFFFF" style="width: 165px; height: 26px; text-align: right">
                                    图片地址：</td>
                                <td bgcolor="#FFFFFF" style="width: 512px; height: 26px; text-align: left">
                                
                                <asp:Panel ID="pnBtnUpLoad" runat="server">
    <asp:FileUpload ID="fupd" runat="server" />
    <asp:Button ID="btnUpFileImg" runat="server" Text="上传" onclick="btnUpFile1_Click" CausesValidation="False" />
</asp:Panel>
 <asp:Panel ID="pnSignImg" runat="server" Visible="false">
                             <asp:TextBox ID="txtImgPath" runat="server" Width="250px"></asp:TextBox>
      <asp:Button ID="rebtn" runat="server" Text="重新上传"  onclick="rebtn1_Click" CausesValidation="False" />
</asp:Panel>
       
       
                                </td>
                            </tr>
                            <tr style="color: #000000">
                                <td bgcolor="#ffffff" style="width: 165px; height: 26px; text-align: right">
                                    链接介绍：</td>
                                <td bgcolor="#ffffff" style="width: 512px; height: 26px; text-align: left">
                                    <asp:TextBox ID="txtInfo" runat="server" Width="250px" Height="65px" 
                                        TextMode="MultiLine"></asp:TextBox>&nbsp; </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" style="width: 165px; height: 26px; text-align: right">
                                    排序数字：</td>
                                <td bgcolor="#ffffff" style="width: 512px; height: 26px; text-align: left">
                                    <asp:TextBox ID="txtSort" runat="server" Width="50px"></asp:TextBox>
                                    &nbsp;注：数字小的排在前面</td>
                            </tr>
                            <tr style="color: #000000">
                                <td bgcolor="#ffffff" style="width: 165px; height: 26px; text-align: right">
                                    链接样式：</td>
                                <td bgcolor="#ffffff" style="width: 512px; height: 26px; text-align: left">
                                    <asp:RadioButtonList ID="rBtnShowStype" runat="server" 
                                        RepeatDirection="Horizontal">
                                        <asp:ListItem Selected="True" Value="1">图片</asp:ListItem>
                                        <asp:ListItem Value="0">文本</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                            <tr style="color: #000000">
                                <td bgcolor="#ffffff" style="width: 165px; height: 26px; text-align: right">
                                    是否启用：</td>
                                <td bgcolor="#ffffff" style="width: 512px; height: 26px; text-align: left">
                                    <asp:RadioButtonList ID="rBtnState" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Selected="True" Value="1">启用</asp:ListItem>
                                        <asp:ListItem Value="0">禁止</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="height: 26px" bgcolor="#FFFFFF">
                                    &nbsp;<asp:Button ID="btnEditSave" runat="server" OnClick="btnEditSave_Click" 
                                        Text="保存数据" />
                                    <asp:HiddenField ID="hdfFrLinkId" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
        </table> 
</asp:Content>
