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

  • Home
  • SEARCH
  • 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 6730261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:23:17+00:00 2026-05-26T10:23:17+00:00

I have several controls on a page that contain the word DATE in the

  • 0

I have several controls on a page that contain the word “DATE” in the ID. These are specific text boxes for dates only.

Here is an example of what I need to do for each text box control with “DATE” in the ID:

Birth_Date.Text = fnLib.formatDate(Birth_Date.Text, 1)

Anniversary_Date.Text = fnLib.formatDate(Anniversary_Date.Text, 1)

Rather than do this for every single control, is there a way I could do this in some kind of For Each Loop? I am fairly new to ASP.Net (VB) so I am still learning. Thanks

  • 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-26T10:23:17+00:00Added an answer on May 26, 2026 at 10:23 am

    Technically you could do this with a loop, something pseudocoded like this.

    foreach(Control currentControl in this.Controls)
    {
       var currentTextbox = currentControl as TextBox;
       if(currentTextbox != null && currentTextbox.Id.EndsWith("_Date"))
         //DO your stuff here
    }
    

    But honestly I’m not sure that is going to get you much, especially if there are lots of other controls…As this has to attempt to cast the item to the target type first. WHich if you have a lot of failures, could be a big performance hit.

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

Sidebar

Related Questions

I have a complex page that has several user controls like galleries, maps, ads
I have a table that has several fixed rows that contain user controls that
I have a page and in that page i have several user controls, so
At my web page, I have several text box controls (eg. Input type=text ...)
I have a ASPX Page that contains several user controls, which are loaded dynamically
I have a page with several CheckBoxList controls with 4 checkboxes in each of
I have several server controls that implement the IValidator interface. As such, they have
I have a dialog confirmation that must be reused for several controls in a
I have a form that has several controls: ProgressBar at the top of the
I have a page that has several ListBox es that have some cascading filtering

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.