Asp.Net C# Whidbey WebUserControl

J

Johnny E Jensen

Hello

I'm trying to implement a WebUserControl ( MyCtrl.ascx ) to a WebForm (
MyWebForm.aspx )
The MyCtrl.ascx has some properties ( Public String FormTitle ) - and some
others.

In VS.2003 I load the WebUserControl like this:

MyCtrl _Ctrl = (MyCtrl)Page.LoadControl("MyCtrl.ascx");
.... ControlContainer.Controls.Add( _Ctrl );
_Ctrl.FormTitle = "Test";

This way to implements the WebUserControl don't work in Whidbey(VS2005) -
Why?
I'm able to load the WebUserControl to the page with:
Control _ctrl = Page.LoadControl("MyCtrl.ascx");
.... ControlContainer.Controls.Add( _ctrl );
But are not able to access the property FormTitle like _ctrl.FormTitle?

Solutions - any one?

Kind regards
Johnny E Jensen
 
J

John Saunders

Johnny E Jensen said:
Hello

I'm trying to implement a WebUserControl ( MyCtrl.ascx ) to a WebForm (
MyWebForm.aspx )
The MyCtrl.ascx has some properties ( Public String FormTitle ) - and some
others.

In VS.2003 I load the WebUserControl like this:

MyCtrl _Ctrl = (MyCtrl)Page.LoadControl("MyCtrl.ascx");
... ControlContainer.Controls.Add( _Ctrl );
_Ctrl.FormTitle = "Test";

This way to implements the WebUserControl don't work in Whidbey(VS2005) -
Why?

I don't know, you tell me!

What do you mean, "don't work"? Please be less vague.
I'm able to load the WebUserControl to the page with:
Control _ctrl = Page.LoadControl("MyCtrl.ascx");
... ControlContainer.Controls.Add( _ctrl );
But are not able to access the property FormTitle like _ctrl.FormTitle?

That would be because _ctrl is of type Control, which does not have a
FormTitle property.


John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top