<%@ Page Title="" Language="C#" MasterPageFile="~/bps/basic.Master" AutoEventWireup="true" CodeBehind="pop_simple_material.aspx.cs" Inherits="bps.bps.pop_simple_material" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    

  <link href="../javascript/datatables/datatables.min.css" rel="stylesheet" />
    <script src="../javascript/datatables/datatables.min.js"></script>


<div style="margin:10px; text-align:left;  " >
	         
         

 
    
 
    
    
   请输入关键字查询   <input class="form-control" id="txt_key" type="text"   style="width:200px; border-radius:0px; display:inline-block"   />
          

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;
          <a class="btn btn-primary btn-flat"  
              onclick=" if(IsOK()) {parent.setMaterial($('#sel').val()); parent.layer.closeAll();} "
              > 提交选中</a>
     
             

     
   





   



 
<asp:Repeater runat="server" ID="rpt_pro2"   EnableViewState="false" >
    <HeaderTemplate>
        <table class="table table-hover" style="margin:10px; width:680px  " id="tbl_products">
             
                <thead>
                    <tr>
                       <th width="150">料号</th>
                       <th width="300px">物料名称</th>
                       <th width="500px">规格</th> 
                    </tr>
                </thead>
           <tbody>

    </HeaderTemplate>
    <ItemTemplate>
        
        <tr>
             <td><%# Eval("code") %></td>
             <td><%#Eval("catname") %></td>
             <td><%#Eval("spec") %></td> 
        </tr>


    </ItemTemplate>

    <FooterTemplate>
        
           </tbody>
        </table>

    </FooterTemplate>
</asp:Repeater>






    </div>


     
     

                 
 <input type="text"  id="sel" name="sel" style="display:none"/>
    
 
 <script>
     

     $(document).ready(function () {

         $('#tbl_products').dataTable({ stateSave: false, "sDom": '<"top">rt<"bottom"p><"clear">' }); 
       
         var table = $('#tbl_products').DataTable();

         $('#tbl_products tbody').on('click', 'tr', function () {

             $('#tbl_products tbody tr').removeClass('selected');

             $(this).addClass('selected');
         });


         $('#txt_key').on('keyup', function () {
             table.search(this.value).draw();
         });

 
          

     });
      
      

 </script>


        
 <script>
     function IsOK() {
         var checked = 0;
         var result = '';
         var item = "";
         var table = $('#tbl_products').DataTable();
         var _c = 0;

         var rows = table.rows('.selected').data();



         for (var i = 0; i < rows.length; i++) {

             checked++;
             var tds = rows[i] 
             var name = tds[0];
             var fullname = tds[1];  
             result = name+'$'+fullname;  
         }

       
         $("#sel").val(result);

         /////////////////////


         if ($("#sel").val().length==0) {
             alert('请至少选择一条记录', 12);
             return false;
         }
         else {
             return true;
         }
     }


 </script>

     
     
     





       

</asp:Content>
