By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,883 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,883 IT Pros & Developers. It's quick & easy.

Dynamicly loading a user control

P: n/a
Ben
Hi

I am using this code to dynamically load a user control:

Dim path As String = "topbar_all.ascx"
Dim ctl As UserControl = CType(Page.LoadControl(path), UserControl)
Page.Controls.Add(ctl)

I get this error when i load the control: "The Controls collection cannot be
modified because the control contains code blocks (i.e. <% ... %>). "

But the code does not contain any code blocks.

Any ideas on the problem?

THanks B

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.