p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=560)
-   -   Chapter 16:Page 615 try it out Checking Roles with IsUserInRole at Runtime (http://p2p.wrox.com/showthread.php?t=80026)

lstew452 July 5th, 2010 11:39 AM

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.

lstew452 July 5th, 2010 12:22 PM

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

Imar July 5th, 2010 02:20 PM

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


All times are GMT -4. The time now is 07:22 PM.

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