Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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
  #1 (permalink)  
Old July 5th, 2010, 11:39 AM
Authorized User
 
Join Date: Jun 2010
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16:Page 615 try it out Checking Roles with IsUserInRole at Runtime

Step 8. The Delete Button does not show. Please advise Larry

code

Protected Sub ListView1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView1.ItemCreated
Select Case e.Item.ItemType
Case ListViewItemType.DataItem
Dim deleteButton As Button = CType(e.Item.FindControl("DeleteButton"), Button)
deleteButton.Visible = Roles.IsUserInRole("Managers")
End Select
End Sub

[/code


User: Manger

I checked the Web Admin:

User
User ID:
E-mail address Active user
Description:

Roles
Select roles for this user:
Manager

This proves the user is set to manager.
  #2 (permalink)  
Old July 5th, 2010, 12:22 PM
Authorized User
 
Join Date: Jun 2010
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16:Page 615 try it out Checking Roles with IsUserInRole at Runtime

In chapter 17 Pg 644 while after adding a new album and clicking on clicking on Edit Photo album the delete button appears. I was signed as manager. Larry
  #3 (permalink)  
Old July 5th, 2010, 02:20 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
This proves the user is set to manager.
Right, but the code checks for Managers (plural):

deleteButton.Visible = Roles.IsUserInRole("Managers")

Hope this helps.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 16 Page 558 runner1181 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 February 9th, 2010 03:18 AM
Chapter 16 Page 576 Question jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 September 25th, 2009 03:20 AM
Roles.deleteuser 16-26 troubles ufdylan BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 August 2nd, 2007 01:35 PM
Chapter 1 Page 16 - Try It Out bradnerdhss BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 31st, 2006 02:11 PM





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