Hi,Please can you help
I'm trying to add a control to alot of pages dynamically from an object.
error :The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
- I cant remove the code blocks <% = %> - because there are to many pages to edit
- I cant add a place holder - because there are to many pages to edit
- Everything must be added from my class
I have attached a simple example project.
Public Class MyObject
Public Sub AddControl()
Dim p As Page = HttpContext.Current.CurrentHandler
Dim myLabel As New Label()
myLabel.Text = "Sample Label"
myLabel.ID = "test"
Please can you help? Thanks