<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserQuery.aspx.cs" Inherits="Dotnet.Admin.UserQuery" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title>员工查询结果</title>

  <script src="../Javascript/jquery3.1.min.js"></script>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" />     
     <script src="../bootstrap/js/bootstrap.min.js"></script>


</head>
<body style=" font-size:12px; font-family:Verdana">
    <form id="form1" runat="server">
        
      <table  class="table">
      <tr valign="top">
      <td width="150px">
      <asp:ListBox runat="server" 
          SelectionMode="Single" 
          ID="lb_lists" 
          Width="145px" 
          Height="320px" 
          AutoPostBack="True" 
              >
      
      
      </asp:ListBox>
      人数:<asp:Literal ID="lt_number" runat="server"></asp:Literal>人
      </td>
      
      <td>
       
    <asp:GridView ID="GridView1" runat="server"
         AllowPaging="True" Width="100%"  PageSize="10"  DataKeyNames="id" AutoGenerateColumns="false"
           DataSourceID="SqlDataSource1">
        <Columns> 
            <asp:BoundField HeaderText="登录名"  DataField="username" HeaderStyle-Width="90px"/>
               <asp:BoundField HeaderText="显示名"  DataField="displayname" HeaderStyle-Width="90px"/>
               <asp:BoundField HeaderText="部门"  DataField="department" HeaderStyle-Width="90px"/>
               <asp:BoundField HeaderText="电话"  DataField="tel" HeaderStyle-Width="90px"/>

            <asp:TemplateField  >
                <HeaderStyle Width="90px" />
                <ItemTemplate>
                    <a href="###" onclick='UserRemoveRole(<%#Eval("id") %>, this)'>移除角色</a>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>

       <HeaderStyle BackColor="#000000" Height="35" ForeColor="#ffffff" Font-Bold="True" HorizontalAlign="Center" />
       <AlternatingRowStyle BackColor="#F2F2F2" />
      <RowStyle BackColor="#ffffff"  Height="28"/>
      <PagerSettings Mode="NumericFirstLast" />  

    </asp:GridView>


      </td>
      </tr>
      </table>
   




    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:connectionstring %>" 
       OnSelected="SqlDataSource1_Selected"
        SelectCommand="SELECT  id, users_users.uid, Username  , DisplayName  ,Department  ,Tel    FROM  users_users  
inner join users_usersinroles on users_users.uid=users_usersinroles.uid 
 where rolename=@rolename "
       >
        
        <SelectParameters>

            <asp:ControlParameter ControlID="lb_lists" Name="rolename" />
        </SelectParameters>
    </asp:SqlDataSource>




        <script>
            
            function UserRemoveRole(id,obj)
            {
               $.get("UserQuery.aspx?t=del&id=" + id+"&R="+Math.random()); 
               $(obj).parent().parent().remove();
            }

        </script>


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