Click here to Skip to main content
15,902,492 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to locate an HTML TextArea control from my app.
i m using a master page and i want to find the control located in conext page

I've tried:


Dim htaDemo As HtmlTextArea = DirectCast(Me.FindControl("TextArea1"), HtmlTextArea)(as  my button is also in the context page)


Where Content1 is the name of the ContentPlaceholder and TA1 is the ID assigned to the Html textarea, but I just get a object reference error.
Ive tried Page.FindControl(), Page.Master.FindControl(), this.FindControl() and just findControl.
Can anyone assist in how I reference a plan html textarea from the codebehind. I have just the runat=server because im applying some client-side javascript which doesn’t function when I do that, so I need to find the client control.
can anyone help me out??? thanks n advance....
Posted
Updated 24-Apr-12 23:47pm
v2

1 solution

Your problem is that FindControl() method looks only in direct child controls.
If your TextArea is deeper in hierarchy it will not find it.
In that case you need to make recursive method that will search through entire control tree.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900