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
Technically you could do this with a loop, something pseudocoded like this.
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.