Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7397807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:47:40+00:00 2026-05-29T03:47:40+00:00

I need to be able to hide 2 options that are displayed from my

  • 0

I need to be able to hide 2 options that are displayed from my dynamic bulletedlist (which is built inside of a DetailsView). Every time I try writing a loop through the BulletedList, I get an error saying that it is not a collection type, so I thought I could loop through the DetailsView to find the items I want to hide.

I can’t change the SQL because this particular bulleted list gets used on 2 different pages, it’s just that on one, I only need to show 2 of the 4 items that are associated with the ID.

<asp:TemplateField HeaderText="Answer(s)" SortExpression="PicklistID">
        <ItemTemplate>
            <asp:HiddenField ID="hiddenPicklistID" runat="server"  
            Value='<%# Bind("PicklistID") %>' />
            <asp:BulletedList ID="blText" runat="server" DataSourceID="dsPicklist" 
            DataTextField="TEXT">
            </asp:BulletedList>
        <asp:SqlDataSource ID="dsPicklist" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SurveyConnectionString %>" 
        SelectCommand="SELECT p.TEXT FROM PICKLIST p 
                       JOIN C_Survey_Questions c 
                       ON p.PICKLISTID = c.PicklistID 
                       AND c.QuestionID = @QuestionID 
                       AND c.SurveyID = @SurveyID 
                       WHERE p.PICKLISTID IS NOT NULL 
                       AND c.PicklistID IS NOT NULL">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="SurveyID" 
                PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="hiddenQuestionID" Name="QuestionID" 
                PropertyName="Value" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        </ItemTemplate>
    </asp:TemplateField>

I’ve tried:

    Protected Sub blText_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim blText As BulletedList
    For Each BulletedListItem In blText

    Next
End Sub

but Visual Studio tells me that it is not a collection type. So I thought I could just put a For Each in the code below. I don’t know how to loop through the DetailsView though, can someone point me in the right direction here?

Protected Sub dvSurveyQuestions_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dvSurveyQuestions.DataBound
End Sub

UPDATE 2/6: I declared my BulletedList by using a FindControl and there were no more errors saying the BulletedList wasn’t declared.

Protected Sub blText_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim blText As BulletedList = dvSurveyQuestions.FindControl("blText")
    For Each i As ListItem In blText.Items

    Next
End Sub

ANOTHER UPDATE: I need to get the blText for the unique QuestionID of 33. The QuestionID is an Integer, but I don’t know how to associate a HiddenField with an Integer field. In this code, “Is” gets underlined saying thatIs operator does not accept opeands of type 'Integer.' So I change the Is to an = and get the error Operator = is not defined for types HiddenField and Integer.

Dim QuestionID = DirectCast(dvSurveyQuestions.FindControl("hiddenQuestionID"), HiddenField)
    If QuestionID Is 33 Then
        Dim blText As BulletedList = dvSurveyQuestions.FindControl("blText")
        For intCursor = (blText.Items.Count - 1) To 0 Step -1
            If blText.Items(intCursor).Text = "Self Directed" Or "Systems" Then
                blText.Items.RemoveAt(intCursor)
            End If
        Next
    End If

This is what works

 Dim QuestionID As Integer = CInt(CType(dvSurveyQuestions.FindControl("hiddenQuestionID"), HiddenField).Value)
    If QuestionID = 33 Then
        Dim blText As BulletedList = dvSurveyQuestions.FindControl("blText")
        For intCursor = (blText.Items.Count - 1) To 0 Step -1
            If blText.Items(intCursor).Text = "Self Directed" Or blText.Items(intCursor).Text = "Systems" Then
                blText.Items.RemoveAt(intCursor)
            End If
        Next
    End If
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:47:40+00:00Added an answer on May 29, 2026 at 3:47 am

    Loop from the Items property of the BulletList.

        For Each i As ListItem In blText.Items
    
        Next
    

    This is probably more specific to your problem…

        For intCursor = (blText.Items.Count - 1) To 0 Step -1
    
            If blText.Items(intCursor).Text = "TextValueToRemove" Then
    
                blText.Items.RemoveAt(intCursor)
    
            End If
    
        Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now that I have nginx setup I need to be able to hide my
I need to be able to quickly convert an image (inside a rails controller)
I'm working on a program for which I need to be able to open
I need to be able to hide the navbar and tabbar when I tap
I'm building a treasure hunter app and I need to be able to hide
I need to be able to hide/show multiple div tags on the same page
I need to be able to hide a row if the numbers in column
I need to be able to hide the soft keyboard in response to clicking
I need to be able to hide or disable a multitude of items (detailsviews,
Users of the website need to able to store images in their area ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.