Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 24th, 2008, 12:02 AM
Authorized User
 
Join Date: Sep 2007
Location: , , .
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

  #2 (permalink)  
Old March 24th, 2008, 09:58 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
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?

  #3 (permalink)  
Old March 24th, 2008, 11:53 AM
Authorized User
 
Join Date: Sep 2007
Location: , , .
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.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:42 PM.


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