有了这几个控件 登陆 注册 一切那么简单
从后台获取用户数据:
this.GridView1.DataSource = Membership.GetAllUsers();
this.DataBind();
添加角色:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string[] roles = Roles.GetAllRoles();
foreach (string str in roles)
{
this.ListBox1.Items.Add(str);
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Roles.CreateRole(this.TextBox1.Text);
this.ListBox1.Items.Add(this.TextBox1.Text);
}
根据选择删除:
Roles.DeleteRole(this.DropDownList1.SelectedValue);
this.DropDownList1.Items.Clear();