using: asp.net 2.0 - [vs2005]
I have a page with a master template named "MasterPage.master" and want to iterate over all of the controls in the Page to set a property.
I tried using this in the Page Unload event:
VB Code:
Dim ctlControl As System.Web.UI.WebControls.WebControl For Each ctlControl In Page.Controls ctlControl.Enabled = False Next
but this gives an exception:
Unable to cast object of type 'ASP.masterpage_master' to type 'System.Web.UI.WebControls.WebControl'.
I tried removing the Master template
but I still get same error but instead of 'ASP.masterpage_master' it
refers to Literal Control.
Am I missing something here?
Please help. Thanks in advance.




Reply With Quote