I\'m using ascx and I need to iterate through all of the controls and selects each that have cssClass attribute set to \'required\'.
I have the following code:
Regarding your comment on the answer above, you need to first check that it is a WebControl and then cast it to a WebControl
WebControl
var webControl = childControl as WebControl; if(webControl != null) { if(webControl.CssClass == 'required') // Do your stuff }