<%@ page language="C#" autoeventwireup="true" inherits="Admin_zh_Products_AdminProColor, YBBQYCMS_deploy" masterpagefile="~/Admin/MasterPage/Default.Master" theme="Standard" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageBody" runat="server">
<script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Admin/js/jquery-latest.pack.js"></script>
<script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Admin/js/main.js"></script>
<style>
#preview{
	position:absolute;
	border:1px solid #ccc;
	background:#333;
	padding:5px;
	display:none;
	color:#fff;
	}
	img{border:none;}
</style>
    <table style="width:100%">
        <tr>
            <td>
                <DataLayerWebControls:HeadMenuWebControls ID="HeadMenuWebControls1" runat="server"
                    HeadOPTxt="产品颜色列表" HeadTitleTxt="产品颜色管理" HeadHelpTxt="帮助">
                </DataLayerWebControls:HeadMenuWebControls>
                <DataLayerWebControls:TabOptionWebControls ID="TabOptionWebControls1" runat="server">
                    <DataLayerWebControls:TabOptionItem ID="TabOptionItem1" runat="server" Tab_Name="产品颜色列表">
                        <asp:GridView ID="GridView1" runat="server">
                            <Columns>
                                <asp:TemplateField>
                                  <ItemTemplate>
                                         <input name="CheckBox" id="CheckBox" value="<%#Eval("ID") %>" type="checkbox" />
                                  </ItemTemplate>
                                  <HeaderTemplate>
                                         &nbsp;<input id="CheckboxAll" type="checkbox" value="0" onclick="SelectAll();" />
                                  </HeaderTemplate>
                              </asp:TemplateField>
                                <asp:TemplateField SortExpression="ID" HeaderText="序号">
                                    <ItemTemplate>
                                        <a href="AdminProColorManager.aspx?ColId=<%# Eval("Id") %>&ProId=<%= ProId %>&CMD=List">
                                            <%# (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + Container.DataItemIndex + 1%>
                                        </a>
                                    </ItemTemplate>
                                    <ItemStyle Wrap="True" />
                                    <HeaderStyle Wrap="False" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="产品颜色" DataField="ColorName" />
                                <asp:TemplateField HeaderText ="颜色图片">
                                <ItemTemplate>
                                <a href="<%# ReturnImgSrc((string)Eval("ColorPhotoUrl")) %>" class="preview"><img src="<%# ReturnImgSrc((string)Eval("ColorPhotoUrl")) %>" /></a>
                                </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="是/否默认">
                                    <ItemTemplate>
                                            <%# ReturnIsDefault(Eval("IsDefault").ToString())%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="操作">
                                    <ItemTemplate>
                                        <a href="AdminProColorManager.aspx?CMD=Edit&ColId=<%# Eval("Id") %>&ProId=<%= ProId %>">编辑</a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <DataLayerWebControls:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged">
                        </DataLayerWebControls:AspNetPager>
                        <asp:Button ID="Button2" Visible="false" CssClass="button_bak" runat="server" Text="删除"
                            OnClientClick="return deleteop();" OnClick="Button2_Click" />
                    </DataLayerWebControls:TabOptionItem>
                </DataLayerWebControls:TabOptionWebControls>

                <script language="javascript" type="text/javascript">
<!--

                    function SelectAll() {
                        var e = document.getElementsByTagName("input");
                        var IsTrue;
                        if (document.getElementById("CheckboxAll").value == "0") {
                            IsTrue = true;
                            document.getElementById("CheckboxAll").value = "1"
                        }
                        else {
                            IsTrue = false;
                            document.getElementById("CheckboxAll").value = "0"
                        }
                        for (var i = 0; i < e.length; i++) {
                            if (e[i].type == "checkbox") {
                                e[i].checked = IsTrue;
                            }
                        }
                    }
                    function deleteop() {
                        var checkok = false;
                        var e = document.getElementsByTagName("input");
                        for (var i = 0; i < e.length; i++) {
                            if (e[i].type == "checkbox") {
                                if (e[i].checked == true) {
                                    checkok = true;
                                    break;
                                }
                            }
                        }
                        if (checkok)
                            return confirm('删除后不可恢复,确认要批量删除选中记录吗？');
                        else {

                            alert("请选择要删除的记录!");
                            return false;
                        }
                    }
// -->
                </script>

            </td>
        </tr>
    </table>
</asp:Content>