<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="Pop_Users.aspx.cs" Inherits="Dotnet.Common.Pop_Users" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
  
   
    <script src="../javascript/jquery-1.9.1.min.js"></script>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <script src="../javascript/layer/layer.js"></script>
    
    <link href="../javascript/datatables/datatables.css" rel="stylesheet" />
    <script src="../javascript/datatables/datatables.min.js"></script>

     <link href="../style/patch.css" rel="stylesheet" />
    <style>
        table.dataTable tbody tr.selected {
    background-color: #b0bed9; color:#ffffff; 
}
    </style>
</head>
<body  style="margin:8px" >
    <form id="form1" runat="server">
     
   
         

<div style="margin:2px; text-align:right" >
	         
                                   
         过滤：<asp:DropDownList runat="server" ID="ddl_dept" AppendDataBoundItems="true" AutoPostBack="true"  CssClass="form-control" style="width:200px; display:inline-block" OnSelectedIndexChanged="ddl_dept_SelectedIndexChanged" >
           

          </asp:DropDownList>
               
        
 
      &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
    
    
      <input class="form-control" id="txt_key" type="text"  placeholder="输入关键字查找" style="width:200px; display:inline-block"   />
          
          <button class="btn btn-primary btn-flat" id="btnSelect"
              onclick="if(!Issel()) return false; parent.setuser($('#sel').val()); parent.layer.closeAll(); "
              > 提交选中</button>


     
     
      &nbsp; &nbsp;&nbsp; &nbsp;
    
     
</div>
         

    <table class="table table-hover" style="border-top:solid 1px #eee"  id="tbl_users">
             
                <thead>
                    <tr>
                        <th  style="display:none"> UID  </th>
                        <th width="150px">登录名</th>
                        <th width="100">显示名</th>                        
                          <th width="120">电话</th>
                        <th style="width:200px;">邮件</th>
                         <th  width="80" >员工号</th> 
                        <th width="90px">部门</th>
                       <th  style="display:none">PINYIN</th>
                    </tr>
                </thead>
           <tbody>

 
<asp:Repeater runat="server" ID="rpt_user" EnableViewState="false"   >
    
    <ItemTemplate>
        
        <tr  ondblclick="if(!Issel()) return false; parent.setuser($('#sel').val()); parent.layer.closeAll(); " >
              <td  style="display:none">  <%# Eval("uid") %>       </td>
              <td  > <%#Eval("username") %></td>
              <td><%#Eval("displayname") %></td>
              <td><%#Eval("tel") %></td>
              <td ><%#Eval("email") %></td>
              <td  ><%#Eval("staffcode") %></td> 
              <td><%#Eval("department") %></td>
              <td  style="display:none"><%#Eval("pinyin") %></td>
        </tr>


    </ItemTemplate>

   
</asp:Repeater>



           </tbody>
        </table>


          
 
     

       <input type="hidden" name="sel" id="sel"/>


                 
 
    
 
 <script>


     $(document).ready(function () {

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



         $('#tbl_users tbody').on('click', 'tr', function () {
           
             $('#tbl_users  tbody tr').removeClass('selected'); 
            
             $(this).addClass('selected');
         });

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

     });




 

     function Issel() {
         var checked = 0;
         var result = '';
         var table = $('#tbl_users').DataTable();
         var _c = 0;

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

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

             checked++;
             var tds = rows[i]

             var uid = tds[0];
             var username = tds[1];
             var displayname = tds[2];
             var tel = tds[3];
             var email = tds[4];
             var staffcode = tds[5];
             var dept = tds[6];

             result = result + uid + "$" + username + "$" + displayname + "$" + tel + "$" + email + "$" + staffcode + "$" + dept + "!";
           
         }
    

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


 </script>
     
  
 
    </form>
</body>
</html>


  