placeholder and findcontrol

S

shark

I have a placeholder in a control that is in turn, used as a control in
a placeholder in a form.

I am getting a viewstate error so I believe I have to clear my
placeholder before I load the control within the control.

How to I address this placeholder to clear it? The following gives me a
null object error:

PlaceHolder myPlaceHolder =
(PlaceHolder)this.FindControl("Form1").FindControl("PlaceHolder5");
myPlaceHolder.Controls.Clear();
myPlaceHolder.Controls.Add(myControl);


(Form1 is the aspx page that holds a placeholder. That placeholder has
its own dynamic controls).

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top