<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetGoods.aspx.cs" Inherits="TotCms.Web.Admin.Shop.GetGoods" %>
<%@ Register src="../UI/main_top.ascx" tagname="main_top" tagprefix="uc1" %>

<%@ Register assembly="TotCms.Controls" namespace="TotCms.Controls" tagprefix="cc1" %>
<!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>
    <script src="../../js/jquery-1.5.1.min.js" type="text/javascript"></script>
    <link href="../style/global.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
      function Sel(o) {
        var v=$('#goods_'+o).html();
        var arr = v.split(',');
        var opener = window.parent;
        opener.document.getElementById('Goods').value =opener.document.getElementById('Goods').value+arr[0] + ',';
        var tb = opener.document.getElementById('GoodsIds');
        var offset=tb.rows.length;
        var tr = tb.insertRow(offset);
        tr.setAttribute("id", 'tr_'+arr[0]);
        tr.insertCell(0).innerHTML = '<img src="' + arr[2] + '" />';
        tr.insertCell(1).innerHTML = arr[1];
        tr.insertCell(2).innerHTML = "<a href='javascript:DelTr("+arr[0]+")'>删除</a> ";  
      }
      function Sel_OnClick(o) {
        o.innerHTML = '已添加';
      }
    </script>
</head>
<body>
   <div id="dialog-win" title="选择分类" style="display:none;">
	  <iframe src="../Category/Get_Tree.aspx?datamodule=<%=(int)TotCms.FrameWork.Enums.DataModule.Shop %>" width="370" height="350" frameborder="0" scrolling="auto"></iframe>	
   </div>
    <form id="form1" runat="server">    
    <div>    
      <uc1:main_top ID="main_top1" runat="server" />    
    </div>
    <table cellpadding="0" cellspacing="1" border="0" width="100%">
      <tr>
        <td class="topic">
        <span class="right">
        关键字：<asp:TextBox ID="tbKey" runat="server"></asp:TextBox>
          <asp:Button ID="Button1" runat="server" Text="搜索" onclick="Button1_Click" />
        </span>
        </td>
      </tr>   
      </table>
      <table cellpadding="0" cellspacing="1" border="0" width="100%">
      <asp:Repeater ID="RepeatList" runat="server">
        <HeaderTemplate>
          <tr class="suphead">
              <td>名称</td>              
              <td>价格</td>
              <td>添加</td>
          </tr>
        </HeaderTemplate>
        <ItemTemplate>
          <tr class="lines">
            <td>
            <div id='goods_<%# Eval("id") %>' style="display:none;"><%# Eval("id") %>,<%# Eval("Title") %>,<%# Eval("ViewImg")%></div>
            <div align="left">&nbsp;
            <a href="/Goods/Show.aspx?id=<%# Eval("id") %>" target="_blank">
            <img src='<%# Eval("ViewImg")%>' width="90" height="90" border="0" alt="" /><br />
            <%# Eval("Title")%></a>
            </div></td>            
            <td><%# Eval("Price")%></td>          
            <td><div onclick="Sel_OnClick(this)"><a href='javascript:Sel(<%# Eval("id") %>)'>添加</a></div></td>
          </tr>
         </ItemTemplate>
         </asp:Repeater>      
      
    </table>
    <cc1:Pager ID="Pager1" runat="server" GenerateFirstLastSection="True" 
      GenerateGoToSection="True" GenerateHiddenHyperlinks="False" 
      QueryStringParameterName="CurrentPage" OnCommand="pager_Command" 
      GoToStyle="text" OfClause="/" PageClause="页" PageSize="5" />      
    </form>
    <script language="javascript" type="text/javascript">
      function SeleAct(obj) {
        if (obj == "remove") {
          document.getElementById("selclass").className = 'selclass';
        }
        else {
          document.getElementById("selclass").className = 'hidden';
        }
      }
     </script>

</body>
</html>
