Home All Groups Group Topic Archive Search About
Author
31 Mar 2005 8:37 PM
Louis Yeung
Hi,

I created my very first code-behind user control (ascx) and tried to used it
in the aspx within the same project. I have the following questions:

1. Can I select the user control and drag it into the aspx designer view? I
dragged the ascx from the solution explorer view. VS2003 created a design
time item on the top left corner, but I cannot move it to my intended
position? I am confused that the ascx designer view stated doing something
extra if you need to position the user control.

2. If I expose new properties and methods in the user control and uses it in
aspx, does VS2003 know these new properties (i.e. intelligense) and methods?
I am trying to dive into server control.

3. If my solution has multiple projects and my user control is in project A,
then project B in my solution cannot use this user control. Please confirm.

Thanks in advance.
...Louis Yeung

Author
1 Apr 2005 4:37 PM
Steve C. Orr [MVP, MCSD]
User controls are intended for use within a single project.
For additional reusability (between projects) it's best to create a Custom
control instead.
Here's more info:
http://steveorr.net/faq/usercustom.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net



Show quoteHide quote
"Louis Yeung" <LouisYe***@discussions.microsoft.com> wrote in message
news:88E0AD92-1AF7-40F7-B894-AF64865C34E3@microsoft.com...
> Hi,
>
> I created my very first code-behind user control (ascx) and tried to used
> it
> in the aspx within the same project. I have the following questions:
>
> 1. Can I select the user control and drag it into the aspx designer view?
> I
> dragged the ascx from the solution explorer view. VS2003 created a design
> time item on the top left corner, but I cannot move it to my intended
> position? I am confused that the ascx designer view stated doing something
> extra if you need to position the user control.
>
> 2. If I expose new properties and methods in the user control and uses it
> in
> aspx, does VS2003 know these new properties (i.e. intelligense) and
> methods?
> I am trying to dive into server control.
>
> 3. If my solution has multiple projects and my user control is in project
> A,
> then project B in my solution cannot use this user control. Please
> confirm.
>
> Thanks in advance.
> ..Louis Yeung
Author
1 Apr 2005 6:23 PM
Louis Yeung
Steve,

I agree with your point. What is the point of using user control if I cannot
even manipulate the user control. All example has the following pattern 1
form including 1 user control instance.

In real life, I have 1 form with std controls, say 1 user control instance
(at specific position) and more std controls. I can understand there is no
design time support. What about runtime?

I try to write a code-behind user control myTextBox, = WebControls.textbox +
"public int myNumber" property. Since myTextBox is inherited from
UserControl, all the textbox property such as style etc is hidden. This is
why I ask the above question.