Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution 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 November 21st, 2004, 03:31 PM
Authorized User
 
Join Date: Oct 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why can't i create a role?

Why can't i create a role?
I can create a account. but when i create a role with admin, the page only change the advertisement. There isn't a new role in the database.
I can do it before i rebuild the site
I have not changed the code
please help!

 
Old November 24th, 2004, 02:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've seen this myself, but I played around with it and got it working.

I think the problem may be that your event is not hooked correctly. Look at the hidden Web form designer code in Roles.aspx.cs (assuming C# version) and look for this:

this.NewRoleButton.Click += new System.EventHandler(this.NewRoleButton_Click);
this.Load += new System.EventHandler(this.Page_Load);

If you have these 2 lines, then something else is messing up your event handling. Put a breakpoint in the handler for NewRoleButton_Click. See if this breakpoint is hit when you press the button. If your event handling is messed up, then this handler is not being called.

I wish I could remember exactly what caused my problem, but I can't remember the details right now.

Eric
 
Old November 24th, 2004, 06:39 PM
Authorized User
 
Join Date: Oct 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There aren't two lines in the code, it is the code as the below

private void NewRoleButton_Click(object sender, System.EventArgs e)
        {
            int newId;
            Role newRole = new Role();
            newRole.Description = NewRoleDescription.Text;
            newId = newRole.Create();

            DataRow roleRow = roles.Tables["Roles"].NewRow();
            roleRow["Description"] = NewRoleDescription.Text;
            roleRow["RoleID"] = newId;
            roles.Tables["Roles"].Rows.Add( roleRow );

            RoleList.DataSource = roles.Tables["Roles"];
            RoleList.DataBind();
            NewRoleDescription.Text = "";
        }

please help

 
Old November 25th, 2004, 05:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You didn't look in the region for the Web desiger created code like I asked you to.

The button click procedure is where I asked you to put a breakpoint. Put a breakpoint on this line:
Role newRole = new Role();

Run the App, click on the button, and see if you can single-step thru the creation of the role object.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with accessibility and role hertendreef ASP.NET 2.0 Professional 1 June 19th, 2007 09:46 AM
Membership and Role Management frosty ASP.NET 2.0 Basics 1 July 18th, 2006 12:46 AM
Role of interface ajit Java Databases 1 July 1st, 2006 08:15 PM
Role Count Walden SQL Server 2000 1 June 9th, 2003 12:19 PM





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