Hey everyone,
I'm fairly new to ASP.Net and VB, but I have been learning pretty well. I have created a loop to go through one "View" section of a MultiView step form, and find which checkboxes have been checked. Depending on the boxes checked, I am trying to create new labels on a "Review" page that will display the "Text" attribute value of the checkbox that is being iterated through. This is my code below, for a few of the checkboxes as well as the loop. Currently it loops through correctly and displays the ID of the checkbox as that is what I have the loop doing, i'm just not sure how to access the text property.
Thanks in advance

<asp:View ID="View3" runat="server">
            <strong>6. Referral Source:</strong><asp:Panel ID="Panel7" runat="server">
                <asp:CheckBox ID="RefCurPat" runat="server" 
                    Text="Inquirer is former......" />
                <br />
                <asp:CheckBox ID="RefFormPat" runat="server" 
                    Text="Inquirer heard about program......" />
                <br />
                <asp:CheckBox ID="RefFriendFam" runat="server" Text="Friends / Family" />
                <br />
                <asp:CheckBox ID="RefIntSearch" runat="server" AutoPostBack="True" 
                    Text="Internet Search: " />
                <asp:TextBox ID="RefIntSearchText" runat="server" Visible="False" 
                    Width="180px"></asp:TextBox>
For Each ctrl As Control In View4.Controls
            If TypeOf ctrl Is CheckBox Then
                If CType(ctrl, CheckBox).Checked = True Then
                    For i = 0 To ctrl.Controls.Count
                        Dim lbl As New Label
                        lbl.Text = ctrl.ID & "<br/>"
                        RefPanel.Controls.Add(lbl)
                    Next
                End If
            End If
        Next

any help is greatly appreciated.
Thanks again,
Nick G

try below code

foreach (ViewItem lst in View4.Items)
        {
            if (lst.Selected)
            {
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.