Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2008, 12:02 AM
Authorized User
 
Join Date: Sep 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sully7
Default AddEditRole.aspx

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

 
Old March 24th, 2008, 09:58 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

At first cursory glance, the code looks okay. What kind of error are you getting?

 
Old March 24th, 2008, 11:53 AM
Authorized User
 
Join Date: Sep 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sully7
Default

Well, it was a stupid mistake. I was missing a } at the end of my class file. Haha thanks guys. sorry.






Similar Threads
Thread Thread Starter Forum Replies Last Post
New.aspx works but login.aspx fails Validation nigelhamilton BOOK: ASP.NET Website Programming Problem-Design-Solution 8 September 13th, 2004 02:29 AM
New.aspx works but not Login.aspx ? reidcor BOOK: ASP.NET Website Programming Problem-Design-Solution 2 May 24th, 2004 10:32 AM
new to ASPX wesamo ASP.NET 1.0 and 1.1 Basics 2 April 19th, 2004 11:50 PM
HowTo Pass Form data from Page1.aspx to Page2.aspx dati ASP.NET 1.0 and 1.1 Basics 6 January 27th, 2004 06:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.