Disabling all “TextBoxes” and “DropDownLists” on an Ironspeed ASPX page programmatically

I recently had a requirement to make all but one field on an Ironspeed ASPX page ready only when certain conditions are met on the form. I could have easily hardcoded the controls I wanted to disable, but this had to be dynamic for new fields that may be added to the form in the future. I wrote this function to loop through all of the controls (and the many nested controls) and disable all of the text boxes and drop down lists.

 I added this function to Region #1 of the CS file for the page:

Once this is set, I just call this function passing in the top level control on the page from the prerender event if the record was flagged as an “Order” and the current user was not an administrator.