HighTechTalks DotNet Forums  

Iterate through page controls

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Iterate through page controls in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Avon
 
Posts: n/a

Default Iterate through page controls - 04-23-2006 , 04:33 PM






Hi friends,

I need of some help,

I have this code:



For Each t As TextBox In Page.Controls ' here is the error



t.Text = "test"

Next



But I am getting this error:

Unable to cast object of type 'ASP.masterpages_maindesign_master' to type
'System.Web.UI.WebControls.TextBox'.





Please help me to understand this error and solve the problem

Thanks in advance



Reply With Quote
  #2  
Old   
Sebastian
 
Posts: n/a

Default RE: Iterate through page controls - 04-24-2006 , 03:09 AM






Hi Avon,

"Page.Controls" - you're probably in your masterpage and trying to interate
througth masterpage controls (placeholders). Try to interate t. your content
control.

Hope it helps,
Sebastian

"Avon" wrote:

Quote:
Hi friends,

I need of some help,

I have this code:



For Each t As TextBox In Page.Controls ' here is the error



t.Text = "test"

Next



But I am getting this error:

Unable to cast object of type 'ASP.masterpages_maindesign_master' to type
'System.Web.UI.WebControls.TextBox'.





Please help me to understand this error and solve the problem

Thanks in advance




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.