<%@ control language="C#" autoeventwireup="true" inherits="UserControl_SelectBinding, ShopWe" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<script type="text/javascript">
var chars = [ '0','1','2','3','4','5','6','7','8','9',   
        'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',   
        'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
function generateMixed(n) {
    var res = "";
    for(var i = 0; i < n ; i ++) {
        var id = Math.ceil(Math.random()*62);
        res += chars[id];
    }
    return res;
} 

function AddBinding(Guid,Name,Number,Price)
{
   var ObjID=generateMixed(10);
   var largess=document.getElementById("SelectBindingDiv");
   largess.innerHTML+="<li id=\"BindingRow"+ObjID+"\"><input name=\"BindingGuid\" type=\"hidden\" value="+Guid+" />"+
                      "<a href=\"#\" class=\"blue\">"+Name+"</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" class=\"blue\">"+Number+"</a>&nbsp;&nbsp;&nbsp;&nbsp;"+
                      "<a href=\"#\" class=\"blue\">"+Price+"</a>&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"../css/images/x.jpg\" alt=\"删除\" />"+
                      "<a href=\"#\" class=\"grey\" onclick='DeleteSelectBinding(\"BindingRow"+ObjID+"\")'>删除</a></li>";
}
function DeleteSelectBinding(ObjID)
{
   var Row= document.getElementById(ObjID);
   Row.parentNode.removeChild(Row);   //删除
   //document.getElementById("fileDiv").removeChild(document.getElementById("file" + obj));
}
</script>

<div class="come_title">
    <h2>
        优惠套件</h2>
    <h3>
        （商品的详细介绍，可以图文并茂）</h3>
</div>
<asp:Repeater ID="SelectBinding" runat="server">
    <HeaderTemplate>
        <div class="k_all3">
            <table width="100%" cellpadding="0" cellspacing="0" id="bk_2" >
                <thead>
                    <tr>
                        <th style="width: 300px">
                            套件名称</th>
                        <th style="width: 80px">
                            积分</th>
                        <th style="width: 80px">
                            日期</th>
                        <th>
                            操作</th>
                    </tr>
                </thead>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <a href="#" class="blue">
                    <%# Eval("BindingName") %>
                </a>
            </td>
            <td>
                <%# Eval("BindingNumber")%>
            </td>
            <td class="ys_2">
                <%# Eval("BindingPrice")%>
            </td>
            <td>
                <img src="../css/images/add_img.gif" alt="添加套装" /><a href="#" class="blue" onclick="AddBinding('<%# Eval("BindingGuid") %>','<%# Eval("BindingName")%>','<%# Eval("BindingNumber") %>','<%# Eval("BindingPrice") %>')">添加</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table> </div>
    </FooterTemplate>
</asp:Repeater>
<div class="k_all3">
    <div id="bk_line">
        <div class="txte">
            一共 375 个商品 27页
        </div>
        <div class="yahoo2">
            <webdiyer:AspNetPager ID="AspNetPagerBinding" runat="server" OnPageChanged="AspNetPagerBinding_PageChanged"
                CssClass="yahoo2">
            </webdiyer:AspNetPager>
        </div>
    </div>
</div>
<div class="come_title">
    <h2>
        已经添加的套件</h2>
    <h3>
        （商品的详细介绍，可以图文并茂）</h3>
</div>
<div class="din">
    <ul id="SelectBindingDiv">
        <asp:Literal ID="BindingDiv" runat="server"></asp:Literal>
    </ul>
</div>
