<%@ control language="C#" autoeventwireup="true" inherits="Admin_UserControl_SelectOptionGroup, ShopWe" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ 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 AddOptionalGroup(Guid,Name)
{
   var largess=document.getElementById("OptionalDiv");
   var ObjID=generateMixed(10);
   largess.innerHTML+="<li id=\"Row"+ObjID+"\"><input name=\"InputGroupGuid\" type=\"hidden\" value="+Guid+" />"+
                      "<a href=\"#\" class=\"blue\">"+Name+"</a>&nbsp;&nbsp;&nbsp;&nbsp;"+
                      "<img src=\"../css/images/x.jpg\" alt=\"删除\" /><a href=\"#\" class=\"grey\" onclick='DeleteSelectGoods(\"Row"+ObjID+"\")'>删除</a></li>";
}
function DeleteSelectGoods(ObjID)
{
   var Row= document.getElementById(ObjID);
   Row.parentNode.removeChild(Row);   //删除
   //document.getElementById("fileDiv").removeChild(document.getElementById("file" + obj));
}

//添加或隐藏添加属性
function show(id)
{
if(document.getElementById(id).style.display=="none")
{
document.getElementById(id).style.display="block";
}
else
{
document.getElementById(id).style.display="none";
}
}
</script>

<div class="come_title">
    <h2>
        增值商品</h2>
    <h6>
        （你可以立即给此商品<a href="AddOptionGroup.aspx?close=close" target="_blank" class="come_blue">添加一个属性组</a>，然后通过<asp:LinkButton
            ID="UpdateList" runat="server" CssClass="come_blue" OnClick="UpdateList_Click" CausesValidation="false">更新属性组列表</asp:LinkButton>选择你刚才添加的属性组）</h6>
</div>
<asp:UpdatePanel ID="UpdatePanelOption" runat="server">
    <ContentTemplate>
        <div class="k_all3">
            <table width="100%" cellpadding="0" cellspacing="0" id="bk_2">
                <thead>
                    <tr>
                        <th style="width: 30px">
                            选择
                        </th>
                        <th style="width: 500px">
                            选项组名称</th>
                        <th>
                            是否多选</th>
                        <th>
                            展开</th>
                    </tr>
                </thead>
                <asp:Repeater ID="RepeaterTable" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <a href="#" class="blue" onclick="AddOptionalGroup('<%# Eval("ID") %>','<%# Eval("Name") %>')">
                                    选择</a>
                            </td>
                            <td>
                                <%# Eval("Name")%>
                            </td>
                            <td class="lu">
                                <%# Eval("IsRadio")%>
                            </td>
                            <td>
                                <a href="javascript:show('<%# Eval("ID") %>')">展开</a>
                            </td>
                        </tr>
                        <tr id='<%# Eval("ID") %>' style="display: none">
                            <td colspan="4">
                                <div class="k_all5">
                                    <div class="din_all">
                                        <%# GetOptions(new Guid(Eval("ID").ToString()))%>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
        <div class="k_all3">
            <div id="bk_line">
                <div class="txte">
                    <asp:Literal ID="CountItem" runat="server"></asp:Literal>
                </div>
                <webdiyer:AspNetPager ID="AspNetPagerItem" runat="server" AlwaysShow="True" CssClass="yahoo2"
                    OnPageChanged="AspNetPagerItem_PageChanged">
                </webdiyer:AspNetPager>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
<div class="come_title">
    <h2>
        所选属性组</h2>
</div>
<div class="din">
    <ul id="OptionalDiv">
    </ul>
</div>
