<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_Commodity_sort, LebiMall" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>商品排序</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/checked.js"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
        <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/topHead.js" type="text/javascript"></script>
    <script type="text/javascript">
        function updates(){
            var ids = "";
            var values = "";
            var cbxs = "";
            var list=document.getElementsByName("checkbox");
            for(var i=0;i<list.length;i++){
                var hidid = "txt_id"+i;
                var valueid = "txt_sort"+i;
                var cbx ="cbx_cre"+i;
                if(document.getElementById(cbx).checked){cbx = 1;}else{cbx = 0;}
                if(i==(list.length-1))
                {
                    ids +=document.getElementById(hidid).value;
                    values +=document.getElementById(valueid).value;
                    cbxs += cbx ;  
                }else{
                    ids +=document.getElementById(hidid).value+",";
                    values +=document.getElementById(valueid).value+",";
                    cbxs += cbx +",";       
                }
            }
            document.getElementById("ids").value=ids;
            document.getElementById("values").value=values;
            document.getElementById("cbxs").value=cbxs;
            document.getElementById("btnSubmit").click();
        }
        function updete(i){
            var hidid = "txt_id"+i;
            var valueid = "txt_sort"+i;
            var cbx ="cbx_cre"+i;
            if(document.getElementById(cbx).checked){cbx = 1;}else{cbx = 0;}
            document.getElementById("ids").value=document.getElementById(hidid).value;
            document.getElementById("values").value=document.getElementById(valueid).value;
            document.getElementById("cbxs").value=cbx;
            document.getElementById("btnSubmit").click();
        }
    </script>
</head>
<body>
<div id="dhtmltooltip">
        <img src=""></div>
<script type="text/javascript" language="javascript" src="js/js_link.js"></script>
    <form id="form1" runat="server">
        <script>header(2,0,"images/");</script>
   
    <!--面包屑-->
    <div class="blank clearfix"></div>
    
    <!--功能区-->
   <div class="tabmenus mainwidth">
        <ul>
            <li><a href="Commodity_List.aspx"><span>商品管理</span></a></li>
            <li><a href="Commodity_Add.aspx"><span>商品添加</span></a></li>
            <li class="current"><a href="Commodity_sort.aspx"><span>商品推荐</span></a></li>
            <li><a href="Commodity_Search.aspx"><span>商品高级搜索</span></a></li>
        </ul>
    </div>
    <div class="tab-mainbody">
        <div class="tab-mainbody2">
        <div class="functionHandleArea clearfix">
            <input type="image" border="0" title=" 保存 " style="margin:0 0 4px 0 ;"  onclick="updates();return false;" src="images/bt_app.gif"
                                align="absmiddle">
                <span id="msg_sub" class="title_r"></span>
                <script type="text/javascript">
                 var $=jQuery;
                        var i = 2;
                        var f="<%=Session["returnValue"] %>";
                        if(f=="true"){
                            tipsWindown('操作结果','text:操作成功！','250','60','true','2000','true','text');
                            <% Session["returnValue"]= null; %>
                        }
                        if(f=="false"){
                            tipsWindown('操作结果','text:操作失败！','250','60','true','2000','true','text');
                            <% Session["returnValue"]= null; %>
                        }
                       
                    </script>
        </div>
        <div id="datalist">
                <table cellspacing="0" cellpadding="0" id="list">
                    <tr>
                        <th style="width: 30%">
                            产品名称</th>
                          <th style="width:15%">
                          产品图片
                          </th>
                        <th style="width: 15%">
                            排序序号
                        </th>
                        <th style="width: 17%; cursor: pointer;">
                            是否推荐
                        </th>
                        <th style="width: 8%">
                            基本操作
                        </th>
                    </tr>
                    <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                      {
                    %>
                    <tr>
                        <td >
                            <label>
                                <%=ds.Tables[0].Rows[i]["cname"] %>
                            </label>
                            <input type="hidden" id="txt_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                        </td>
                        <td ><%if(ds.Tables[0].Rows[i]["cmin_img"].ToString()!=""){ %>
                           <img src="../images/kind-pic001.jpg" align='absmiddle' onmouseover="javascript:ddrivetip('<div class=hideimg><img src=../Upload/commodity/<%=ds.Tables[0].Rows[i]["cmin_img"].ToString() %>></div>', '#ffffff', '150')"
                                onmouseout="hideddrivetip()" /><%} %></td>
                        <td >
                            <input type="text" id="txt_sort<%=i %>" name="txt_sort<%=i %>" value="<%=ds.Tables[0].Rows[i]["CsyWei"] %>"
                                class="input" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                        </td>
                        <td >
                            <input type="checkbox" name="checkbox" id="cbx_cre<%=i %>" <%if (ds.Tables[0].Rows[i]["crecommend"].ToString()=="1"){%> checked <%} %> />
                        </td>
                        <td >
                            <a href="javascript:updete(<%=i %>)">修改</a>
                        </td>
                    </tr>
                    <%} %>
                    <tr><td colspan="5" class="list-foot">
                        <div style="float: left; padding-top: 3px;">
                                </div>
                                <div id="divAsp" runat="server" style="float: right; padding-top: 3px;">
                                    <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                                        runat="server" RecordCount="228" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                                        PrevPageText="上一页" PageSize="15" UrlPaging="True" CustomInfoClass="pages1" CurrentPageButtonPosition="Center" ShowBoxThreshold="50"
                                        ShowFirstLast="true" NumericButtonCount="4" BackColor="Transparent" ShowDisabledButtons="False" EnableViewState="False">
                                    </webdiyer:AspNetPager>
                                </div>
                    </td></tr>
                </table>

                <script type="text/javascript">tdshowm("list");</script>

            </div>
            <div runat="server" style="display: none">
                <input type="button" runat="server" id="btnSubmit" onserverclick="btnSubmit_ServerClick" />
                <input type="hidden" id="ids" runat="server" />
                <input type="hidden" id="values" runat="server" />
                <input type="hidden" id="cbxs" runat="server" />
            </div>
            </div>
        </div>
    </form>
</body>
</html>
