473,625 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Page Class

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;

Me.Controls.Add (Header)

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 CreateChildCont rols()

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

Header.Text = sbHeader.ToStri ng
Me.Controls.Add (Header)

Me.Controls.Add (Form)

CTMB.ExecuteSec urity = bExecuteSecurit y
Form.controls.a dd(CTMB)

'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
Me.Form.control s.add(Main)
End If

Me.Form.control s.add(CBMB)

'Close of the HTML
Dim sbFooter As New System.Text.Str ingBuilder
With sbFooter
.Append("</body></html>")
End With

Footer.Text = sbFooter.ToStri ng
Me.Controls.Add (Footer)

MyBase.CreateCh ildControls()

End Sub
Nov 17 '05 #1
0 1048

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10830
by: Joe Bloggs | last post by:
Does anyone know if its possible to pass parameters or the values of Request.QueryString from a web page to a custom control class? I'm using a C# Web Application. For Example I have Web Page1 which has to parameters passed to it from another Web page Parameter # 1 dbid and Parameter # 2 reportid. I know that I can access the values of the parameters from the code behind .aspx.cs using Request.QueryString so
6
3246
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A query-string flag is used to indicate to the page whether it should instantiate a new instance of the object or access an existing instance from the calling page. On the both pages I have a property of the page which is an instance of this custom...
3
3748
by: Michael Iantosca | last post by:
I have a custom attribute that I attach to certain pages in my application and I want to inspect each page request as it is made to see if the custom attribute is attached to the underlying page class. If is attached I want to perform some action. How can I access custom attributes from an HttpModule? I have to pass a target to the System.Attribute.GetCustomAttribute() call to attempt to retrieve the attached attribute. I tried to access...
7
2212
by: Joe Rigley | last post by:
Hi, I have a custom class with a public method. I want to perform a repose.redirect if an error occurs in the public method GetUserRoles. Unfortunately, Visual Studio 2003 is throwing an error when I try to do this. I have imported the System.Web namespace and the same code works fine on a ..aspx page. Can you not perform response.redirects in a custom class that is being called by another aspx page? Please help.
6
3795
by: Tabi | last post by:
Hi, I want to create a custom section in my web.config that can hold my custom values. I created a section in web.config as written below. <configSections> <section name="myCustomSection" type="ComIT.Applications.Common.ConfigurationSections.MyHandler" allowLocation="true" allowDefinition="Everywhere" /> </configSections>
7
4740
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service project. The same class lib is included in the ASP.NET Web Application that calls the web-method I can successfully call the web-method with
0
1484
by: hamstak | last post by:
I had developed a custom base page class for the 1.1 framework which I have now migrated to the 2.0 framework. I discovered that the new partial class system -- which appears to "automagically" assign the Page_Load method as the Load event handler in the hidden partial class -- does not carry over to derived Page classes. This being the case, and not wanting to copy what used to be the VS generated code into every derived page, I decided...
4
2779
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying the MasterType directive on the aspx form. My master page will render a custom navigation menu and I'd like to put in the properties of which tab and sub tab to load and other misc style info in the aspx form that can be used by master page.
2
2734
by: Michal Valent | last post by:
I would like to fire some custom server control event before Page_Load event like this (from the trace of an aspx page) : Trace Information Category Message From First(s) From Last(s) aspx.page Begin PreInit aspx.page End PreInit 5,38454603734274E-05 0,000054 aspx.page Begin Init 8,96405962016187E-05 0,000036 aspx.page End Init 0,00072941040948794 0,000640 aspx.page Begin InitComplete 0,000772971258380746 0,000044
4
2475
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.