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 8695135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:57:24+00:00 2026-06-13T00:57:24+00:00

I am designing a user control that attempts to create a filter bar with

  • 0

I am designing a user control that attempts to create a filter bar with various TextBox or DropDownList elements on the page according to the sample markup below:

<gf:GridFilterBar runat="server">
    <filters>
        <filter Label="Field1" Type="TextBox" />
        <filter Label="Field2" Type="DropDownList" />
    </filters>
</gf:GridFilterBar>

Using inspiration from another post, I have created code behind that properly parses this markup and reads in the properties of each intended child control. The issue I am having is when it comes time to actually render this information on the screen. Every control I initialize from within the “New” sub of the “Filter” class never appears on the screen. When I place a breakpoint in the “New” sub and follow what is happening, I can see the Filter.New sub being traversed twice and the values being read in, but nothing else I initialize from within that sub has any effect on the page even though, as far as I can tell, it is all being created successfully. Here is a sample of the code with just the Label property being read:

Imports System
Imports System.Collections
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls


Public Class GridFilterBar
Inherits System.Web.UI.UserControl

Private _Filters As New FiltersClass(Me)

<PersistenceMode(PersistenceMode.InnerProperty)> _
Public ReadOnly Property Filters() As FiltersClass
    Get
        Return _Filters
    End Get
End Property

Private Sub Page_Init(sender As Object, e As System.EventArgs) Handles Me.Init
    DDL.Visible = True
End Sub
End Class

Public Class FiltersClass
Inherits ControlCollection

Public Sub New(ByVal owner As Control)
    MyBase.New(owner)
End Sub

Public Overrides Sub Add(ByVal child As System.Web.UI.Control)
    MyBase.Add(New Filter(child))
End Sub

End Class

Public Class Filter
Inherits HtmlGenericControl

Public Sub New(ByVal GenericControl As HtmlGenericControl)
    Label = GenericControl.Attributes("Label")
    Dim lit As New Literal
    lit.Text = Label.ToString
    Me.Controls.Add(lit)
End Sub

Public Property Label As String = String.Empty

Public Overrides Function ToString() As String
    Return Me.Label
End Function

End Class

Can anyone spot what I’m doing wrong?

  • 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-06-13T00:57:25+00:00Added an answer on June 13, 2026 at 12:57 am

    I was able to answer my question. I added an override sub for CreateChildControls in my main class and used a For Each loop to grab the properties set from each newly initialized “Filter”

    Protected Overrides Sub CreateChildControls()
    
        For Each filter In Filters
    
            Dim lit As New Literal
            lit.Text = filter.Label
            Controls.Add(lit)
    
        Next filter
    
    End Sub
    

    This relegated the Filter.New sub to simply grabbing the properties:

    Public Sub New(ByVal GenericControl As HtmlGenericControl)
        Label = GenericControl.Attributes("Label")
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing my own custom control that contains a .NET dropdownlist. What I'm wondering
while designing my user control, i encountered the following problem: i would like to
I am currently designing an API where I want that the user to be
I'm current designing a Rails application that uses a form for user login, then
Say you’re designing an application that, by requirement, allows a user the flexibility of
I am designing a control where the user can specify the X, Y, Width
I am currently designing a user control which will have other controls contained within
I am designing a WPF user control which contains other user controls (imagine a
I am defining a user control deriving from TextBox class in Windows Forms. The
A little background first: I'm designing a web application for a control system that

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.