[thelist] [ASP.NET] Controls, Page Cycle Problems (and lists)

Thompson, Daniel Daniel.Thompson at fishnetsecurity.com
Tue Sep 9 11:26:34 CDT 2003


Hi,
 
I'm using ASP.NET for the first time and have run into a problem. I'm
hoping someone here may be able to help.
 
I'm trying to redesign a site and create a page template that is called
by all pages within the site. Basically, the template page figures out
if there are controls for certain divs, and then writes those if they
exist. The template is a server control (inheriting Page), and then each
page has a code-behind page, and the actual aspx page. My hope is that
all along this chain, I can add controls (so that in a pinch, I can
change the content of the page using the aspx page, without having to
recompile).
 
Basically, I'm trying to create a nice engine that I can go back to and
add database content management, but still launch the site next Monday.
 
When I am trying to add to some controls, I am receiving the following
error: "'Templates._Default' does not contain a definition for
'Crossbar'"
 
On the aspx page, here is the preceding line, and the offending line:
 
   base.Well.Controls.Add(new LiteralControl("<p><ul><li>item
1</li></ul>"));
   base.Crossbar.Controls.Add(new LiteralControl(@"
                    <div style...</div>"));
 
'Well' (a name for a control) correctly adds all content I throw at it.
Crossbar does not. In the server control class, there is no difference
between the two controls.
 
Does anyone know why I'm receiving this error? This is the last stick in
the spokes on this rudimentary templating system, and I can't figure it
out. My thoughts were perhaps the life cycle was wreaking havoc, but I
don't understand why one would fail and the others would be fine.
 
By the way: the page shell is created OnInit in the server control, the
controls on the aspx page have been added OnPreRender and OnLoad (with
no difference).
 
Also, does anyone know of a good ASP.NET/C# discussion list? Maybe I
could ask it there? My only good lead for a discussion list was shut
down for reasons I haven't figured out.
 
Many Thanks,
-DT

The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. 
Any interception, review, retransmission, dissemination, or other use of, or taking of any action upon this information by persons or entities
other than the intended recipient is prohibited by law and may subject them to criminal or civil liability. If you received this communication 
in error, please contact us immediately at 816.421.6611, and delete the communication from any computer or network system.




More information about the thelist mailing list