Saturday, March 5, 2011

To get user list in asp.net


GetAllUsersExample.aspx

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void Button1_Click(object sender, System.EventArgs e) {  
        ListBox1.DataSource = Membership.GetAllUsers();  
        ListBox1.DataBind();  
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>GetAllUsers method example: how to get user list in asp.net</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2>GetAllUsers Method Example</h2>  
        <asp:Label ID="Label1" runat="server" Text="All Users" AssociatedControlID="ListBox1"></asp:Label>  
        <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>  
        <br />  
        <asp:Button ID="Button1" runat="server" Text="Get All Users" OnClick="Button1_Click" />  
    </div>  
    </form>  
</body>  
</html>

No comments:

Post a Comment