thanks bruce
I am using LoadControl(typ eof("MyControls .MyCtl"),null);
and this does create the proper control. however no child controls are
never created.
I tried calling CreateChildCont rols() in the user control OnInit &
OnPrerender methods after which Controls collection is always empty.
by "specify the class name in the page directive" - do you mean in the user
..ascx Control directive ? or in a Register directive on the .aspx ?
The Control directive looks like this : <%@ Control Language="c#"
AutoEventWireup ="True" Codebehind="MyC tl.ascx.cs"
Inherits="MyCon trols.MyCtl"
TargetSchema="h ttp://schemas.microso ft.com/intellisense/nav4-0" %>
using the Register directive on the page defeats the whole purpose of
dynamic control creation.
gerry
"bruce barker" <no****@nospam. comwrote in message
news:O1******** ******@TK2MSFTN GP02.phx.gbl...
if you pass a string to LoadControl, it wants the path to the file. to
load from the assembly, you need to pass the type and construction
parameters.
PlaceHolder.Con trols.Add(
LoadControl(typ eof(MyControlCl assName),null)) ;
be sure to specify the class name in the page directive.
-- bruce (sqlwork.com)
germ wrote:
>I am moving a web application from 1.1 to 2.0
This site builds pages dynamically as :
PlaceHolder.Co ntrols.Add(Load Control("~/Controls/Ctl1.ascx"));
Everything is working fine as long as the web site is updateable - the
.ascx files exist on disk.
I would like to use the non-updateable and single assembly options - no
.ascx files.
I thought that maybe this would work :
PlaceHolder.Co ntrols.Add(Load Control("AppNam eSpace.Controls .Ctl1",null));
This creates the proper object as defined by the code behind class.
However it never creates any child controls - textboxes etc.
Is there an additional step required to instantiate the page controls ?
Is there a class for the .ascx half of the control that I should be
loading instead ?
...
Gerry