Hey Guys,
I'm trying to design a seperate page for creating and editing user Roles in the admin section, instead of having to go through the EditUser.aspx page. I've been working with it and trying to get it to work for a few hours, and nothing seems to be working. Here's the code I have so far. The class file is as follows:
Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MB.TestingMachines;
namespace MB.TestingMachines.UI.Admin
{
public partial class EditRoles : BasePage
{
protected void btnCreateRole_Click(object sender, EventArgs e)
{
if (!Roles.RoleExists(txtNewRole.Text.Trim()))
{
Roles.CreateRole(txtNewRole.Text.Trim());
}
}
}
and here's the code for the actual page:
Code:
<%@ Page Language="C#" MasterPageFile="~/master.master" AutoEventWireup="true" CodeFile="~/Admin/AddEditRole.aspx.cs" Inherits="MB.TestingMachines.UI.Admin.EditRoles" Title="Lako Tool | Admin | Add/Edit Roles" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<h1>Create new role: </h1>
<asp:TextBox ID="txtNewRole" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireNewRole" runat="server" ControlToValidate="txtNewRole"
ErrorMessage="Role name is required." SetFocusOnError="true" ToolTip="Role name is required."
ValidationGroup="CreateRole">*</asp:RequiredFieldValidator>
<asp:Button ID="btnCreateRole" runat="server" OnClick="btnCreateRole_Click" Text="Create"
ValidationGroup="CreateRole" />
</asp:Content>
After reading through the book again, it looks like the Roles and Users are linked, however I'm really trying to create a page that will seperate them. Thanks