Explanation:
Let us see the Example by examining the Code.
Our .aspx Page ;
<asp:Wizard ID="Wizard1" runat="server"
ActiveStepIndex="0" Height="270px" Width="453px">
<WizardSteps>
<asp:WizardStep runat="server" Title="Get Data" ID="step1"
>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Display Data" ID="step2">
<asp:Table ID="Table1" runat="server">
</asp:Table>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
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()"
|