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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:34:37+00:00 2026-06-09T23:34:37+00:00

I want to list all controls inside another control which have names starting with

  • 0

I want to list all controls inside another control which have names starting with “btnOverlay”. I can’t use Controls.Find, because it needs an exact match. I believe I can use LINQ for this, but I’m not very experienced on that. Is it possible? How can I do it?

I’m using .NET 4.0.

  • 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-09T23:34:40+00:00Added an answer on June 9, 2026 at 11:34 pm

    You could search for them with LINQ via:

    var matches = control.Controls.Cast<Control>()
                         .Where(c => c.Name.StartsWith("btnOverlay"));
    

    The Cast<T> call is required, as ControlCollection does not implement IEnumerable<T>, only IEnumerable. Also, this doesn’t do a recursive search, but only searches the contained controls directly. If recursion is required, you’ll likely need to refactor this into a method similar to this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create custom templated control which controls inside of template coluld be
I have a GridView control which shows a list of all employees. When user
I have many items inside a list control. I want each item to have
In my directory I have subfolders, and I want to list all directories like
I want to list all controls (buttons, datagrids, etc) in a container This works
I have a list of items which I want the user to be able
i am trying to build a statics system i want list all pages in
I want list to all the indesign file in my external HD, I tried
I want to list all .xml files in a dir and its subdir. I
I want to list all files in a directory Using PyroCMS. Using the Files

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.