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

Custom Page Class

P: n/a
I have a custom page class that adds a menu onto any page that inherits it.
It works fine on a simple page but when I try to implement it on an
exisiting, more complex page I get the error "A control cannot modify its
parents' control collections. " on the following line;


In the aspx page I delete all the HTML code and place a panel on the page as
a placeholder. Since it works on a simple page, there's obviously something
about this particular page that's making it fail. I guess I'm looking for a
more high-level explanation of what might cause this issue.

'Base Class Method
Protected Overrides Sub CreateChildControls()

'Write out the title and link up the stylesheet
Dim sbHeader As New System.Text.StringBuilder
With sbHeader
.Append("<html><head> <title>" & strTitle & "</title>")
End With

Header.Text = sbHeader.ToString


CTMB.ExecuteSecurity = bExecuteSecurity

'You need to put a panel on the page to hold everything that you
want displayed in the form
Dim Main As Control = Me.Controls(0) 'Me.FindControl("Main")

If Not Main Is Nothing Then
End If


'Close of the HTML
Dim sbFooter As New System.Text.StringBuilder
With sbFooter
End With

Footer.Text = sbFooter.ToString


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

This discussion thread is closed

Replies have been disabled for this discussion.