Explanation:
Let us see the Example by examining the Code.
Our .aspx Page ;
Our Code Behind;
Protected Sub Wizard1_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Wizard1.ActiveStepChanged
Dim c1 As New TableCell()
Dim c2 As New TableCell()
Dim row As New TableRow()
c1.Text = "Welcome!"
row.Cells.Add(c1)
If (Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.step2)) Then
If (Roles.IsUserInRole(User.Identity.Name, "Members")) Then
c2.Text = "Member"
Else
c2.Text = "Ananymous"
End If
row.Cells.Add(c2)
Table1.Rows.Add(row)
End If
End Sub
You noticed that we creating Table Row in the code behind and on the proper step we display the informations according to their Role.
One thing have to noted that to run get result from this code user have to be Signed-in. If you are admin and you want to get information for the users instead of displaying them to the Users then just use the User Name instead of "User.Identity.Name"
If (Roles.IsUserInRole(UserName, "Members")) Then
c2.Text = "Member"
Else
c2.Text = "Ananymous"
End If
Where "UserName" is either entered menually or taken From the Collection of all users i.e "Membership.GetAllUsers()"
|