Ya that would definitely help. However I found that the reason I can't access properties from with in the user control is because its simply cast as a control, I would need to cast it as a the Server control from inside the user control. All around, it seems to be the better solution to pass the server control in a field called parent and simply access the values through that property.
However, is there a better way to go about all this. It would be great if I could simply attach a UI to my Server Control w/o having to go through the hassle of creating a User Control and adding it to the controls collection. Thanks, James P.S. ConnectWise is a great product, keep up the good work. -----Original Message----- From: Bryan Batchelder [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:47 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Problem w/ Custom Server-Side Control Do you need to call the base CreateChildControls function? --b Bryan Batchelder eBusiness Consultant ConnectWise, Inc. 813-935-7100 x 425 > -----Original Message----- > From: James Alexander [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 2:46 PM > To: [EMAIL PROTECTED] > Subject: [DOTNET] Problem w/ Custom Server-Side Control > > > I've been attempting to write a server-side web control and > have run into a bit of a hurdle. In my web control, I'm > overriding the CreateChildControls method to load a user > control, like this: > > protected override void CreateChildControls () > { > EditorControl oEditorControl = (EditorControl) > Page.LoadControl("editorcontrol.ascx"); > Controls.Add(oEditorControl); > } > > The reason I'm doing this is because I have a lot of > client-side code to generate and it would take a while and be > extremely difficult to debug if I where to use the > StringBuilder class and pass it to the HTMLTextWriter's write method. > > My problem comes in to play when I attempt to access a > property of the Server Side WebControl from within the User > Control. It was my belief that the following snippet should > work correctly: > > <%= this.Parent.ScriptPath %> > > However I get an error saying that ScriptPath cannot be found > in the Control scope. Is there something I'm doing wrong? To > get around this for the time being, after creating the > UserControl by calling Page.LoadControl in the > CreateChildControls method, I'm setting a field called parent > to the current Server-Side WebControl. > > Also, is there a better way for me to separate my > presentation logic for my WebControl logic that wouldn't > require me to overload the CreateChildControls method? > > Thanks, > > James > > You can read messages from the DOTNET archive, unsubscribe > from DOTNET, or subscribe to other DevelopMentor lists at > http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.