accessing all controls of a page..
-
Hi, I am trying to access all controls of a page so that I can Check whether they are textboxex or radiobuttons. I am trying the following code But I am unable to access these controls in a collection. foreach(Control objcontrol in Page.Controls) { if (objcontrol is TextBox) { TextBox tx = (TextBox)objcontrol; ... Can anyone suggest me proper to access all controls in a collection plz????
hiiiiii
-
Hi, I am trying to access all controls of a page so that I can Check whether they are textboxex or radiobuttons. I am trying the following code But I am unable to access these controls in a collection. foreach(Control objcontrol in Page.Controls) { if (objcontrol is TextBox) { TextBox tx = (TextBox)objcontrol; ... Can anyone suggest me proper to access all controls in a collection plz????
hiiiiii
Within "foreach" you can "access" all the controls.. but you can not change the state of objects within. If that is the requirement, then you better access them usin "for" loop and access the controls using indexes. In case, it doesnt answers your questions. PLease be more elaborate about the same. Regards.