<%@ Page Language="C#"   %>

<!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>
    <style>
    *{ font-size:12px; font-family:Verdana}
     th{ font-size:12px; font-family:Verdana; font-weight:bold}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="magin:0 auto; ">
    
    (这里的“delete”并不是删除用户，而是删除用户所属于的角色)
    	    
	
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  HorizontalAlign="center"
        AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" 
          Width="100%"  PageSize=15    GridLines="Both"  AutoGenerateDeleteButton=true 
        >
        <Columns>
             
               
             <asp:TemplateField>
            <ItemTemplate>
            
            <a href="#" onclick=window.open('Setright.aspx?id=<%#Eval("uid")%>',null,'width=520,height=400,left=300,top=300,scrollbars=yes') >Edit</a>
           
            </ItemTemplate>
            <HeaderTemplate>
        
            </HeaderTemplate>
            </asp:TemplateField>
             
            <asp:BoundField DataField="id" HeaderText="编号" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="username" HeaderText="登录名" 
                SortExpression="username" />

                   <asp:BoundField DataField="displayname" HeaderText="显示名" 
                SortExpression="displayname" />

            <asp:BoundField DataField="rolename" HeaderText="当前权限" 
                SortExpression="rolename" />
           
            
            
          
                  
             
        </Columns>
        <RowStyle Width="100"  BorderColor="#f0f0f0" HorizontalAlign="Right"  Height="25"/>
        <HeaderStyle BackColor="#dadada"  HorizontalAlign="right"/>
    </asp:GridView>	    
		    
		    
		    
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [users_usersinroles] WHERE [id] = @id" 
       SelectCommand="SELECT users_usersinroles.*,username,displayname FROM users_usersinroles inner join users_users
on users_usersinroles.uid=users_users.uid  where ((rolename =@rolename) or (@rolename='')  ) " 
       >
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
          
        
        <SelectParameters>
           <asp:QueryStringParameter   ConvertEmptyStringToNull="true"   Name="rolename" QueryStringField="rolename" />
        </SelectParameters>
    </asp:SqlDataSource>



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