By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Please help with user controls

P: n/a
I have now spent 5 hours on google/msdn looking for something useful in the
creation of user controls for asp.net. The VS 2003 has very limited support
for things such as absolute positioning of the control etc.
Nov 18 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
I'm not quite sure what you are looking for, but there is extensive coverage
of user controls not only in my book (Programming ASP.NET -O'Reilly) but in
many other books on Programming ASP.NET. As for positioning, you should be
able to position your user control much like any other control; you may want
to take a look at the portal sample (I buy spy) provided by Microsoft, which
makes extensive use of User Controls.

Best of luck.

-j

-----------
Jesse Liberty
http://www.LibertyAssociates.com
Author: .Net Programming books - O'Reilly

"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:GH*****************@news01.bloor.is.net.cable .rogers.com...
I have now spent 5 hours on google/msdn looking for something useful in the creation of user controls for asp.net. The VS 2003 has very limited support for things such as absolute positioning of the control etc.

Nov 18 '05 #2

P: n/a
..NET Quickstart tutorials are always a good starting point
if you haven't looked at them already.

Web Forms User Controls
-----------------------
http://samples.gotdotnet.com/quickst...us/doc/webpage
lets.aspx

Abosulte positioning can done thru the design mode when
you drag and drop your control on to a web form. Is their
anything more specific you are looking for?

HTH,
Suresh.
-----Original Message-----
I have now spent 5 hours on google/msdn looking for something useful in thecreation of user controls for asp.net. The VS 2003 has very limited supportfor things such as absolute positioning of the control etc.

.

Nov 18 '05 #3

P: n/a
I am trying to use VS 2003. The support is so confusing it is useless. The
articles you refer to have no relation to VS that I can see. None of them
use absolute positioning or VS 2003.

I want tutorials using this software. Why would someone spend +$1000 on
software instead of notepad, the answer to make the development cycle
quicker and less error prone. So far in the creation of user controls I see
no support that makes sense. I am assumming that I just do see the correct
path through VS 2003.

Thanks for the link but that was one of the hundreds I have looked at today.

Lloyd
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
.NET Quickstart tutorials are always a good starting point
if you haven't looked at them already.

Web Forms User Controls
-----------------------
http://samples.gotdotnet.com/quickst...us/doc/webpage
lets.aspx

Abosulte positioning can done thru the design mode when
you drag and drop your control on to a web form. Is their
anything more specific you are looking for?

HTH,
Suresh.
-----Original Message-----
I have now spent 5 hours on google/msdn looking for

something useful in the
creation of user controls for asp.net. The VS 2003 has

very limited support
for things such as absolute positioning of the control

etc.


.

Nov 18 '05 #4

P: n/a
Hi Lloyd,

I've found that wrapping all of the user control html in a asp:panel, and
then exposing that style property of the asp:panel as a public property of
the control, it works real well. this way, you can easily position it.
Example:

<%@Control%>
<asp:panel runat=server id=wrapper>
Put the regular control contents overhere ...
</asp:panel>

.... in the codebehind or in a SCRIPT runat=server block,

Public Property Readonly Style as CssStyleCollection
Get
Return wrapper.style
End Get
End Property

-- Alex Papadimoulis

"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:GH*****************@news01.bloor.is.net.cable .rogers.com...
I have now spent 5 hours on google/msdn looking for something useful in the creation of user controls for asp.net. The VS 2003 has very limited support for things such as absolute positioning of the control etc.

Nov 18 '05 #5

P: n/a
Ok guys thank for the help. Let me explain what I have tried.

1. Create a Web User Control within ASP project.
2. Add GridFlow panel and add controls within
3. Drag WUC to the asp page I want to have the control on.

Now the problems commence.

A. No support for absolute positioning of the control.
B. No reference to the control in the VB codebehind page.

So that is useless for my purposes.

Next try.

1. Create Web Control Library

Now the problems commence (already). When I go to add the web control I can
only add windows form controls. Now the help line on the New Project dialog
states "A project for creating controls to use in Web applications". The
problem is that within this project there is no designer support.

Now after some experimenting I see that if I just say add new item then the
selections change. MS please please fix VS. Now there is still no designer
support. What good is an IDE if all you really need is notepad.

All in all totally useless for RAD.

Lloyd Sheen
Nov 18 '05 #6

P: n/a
>A. No support for absolute positioning of the control.
You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.
B. No reference to the control in the VB codebehind page.
This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.

HTH,
Suresh.
-----Original Message-----
Ok guys thank for the help. Let me explain what I have tried.
1. Create a Web User Control within ASP project.
2. Add GridFlow panel and add controls within
3. Drag WUC to the asp page I want to have the control on.
Now the problems commence.

A. No support for absolute positioning of the control.
B. No reference to the control in the VB codebehind page.

So that is useless for my purposes.

Next try.

1. Create Web Control Library

Now the problems commence (already). When I go to add the web control I canonly add windows form controls. Now the help line on the New Project dialogstates "A project for creating controls to use in Web applications". Theproblem is that within this project there is no designer support.
Now after some experimenting I see that if I just say add new item then theselections change. MS please please fix VS. Now there is still no designersupport. What good is an IDE if all you really need is notepad.
All in all totally useless for RAD.

Lloyd Sheen
.

Nov 18 '05 #7

P: n/a
I have tried some of the things you have suggested.

A. No support for absolute positioning of the control. You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.


I can make the designer place the control by stealing position info from
another control. This is lost when the page renders.
B. No reference to the control in the VB codebehind page.


This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.


My big bitch is that a development IDE that requires the user to do
everything manually is a waste of money. I have tried so many things today
I know that one thing I did created the control. The problem with just
declaring it is that there is no instant of the control during run-time.

Nov 18 '05 #8

P: n/a
Hi Lloyd,

I completely agree with you -- the VS.NET IDE is pretty worthless when it
comes to making decent looking websites. However, it's an essential took
for creating your middle tier classes -- the integration with SQL Server,
intellisense, and so on are all wonderful. I'd advise sticking with
Dreamweaver to develop the ASPX pages and ASCX controls, and just use VS.NET
to develop your middle tier. I've found that to be the most productive
approach.

Alex Papadimoulis
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:b7******************@news01.bloor.is.net.cabl e.rogers.com...
I have tried some of the things you have suggested.

A. No support for absolute positioning of the control. You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.


I can make the designer place the control by stealing position info from
another control. This is lost when the page renders.
B. No reference to the control in the VB codebehind page.


This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.


My big bitch is that a development IDE that requires the user to do
everything manually is a waste of money. I have tried so many things

today I know that one thing I did created the control. The problem with just
declaring it is that there is no instant of the control during run-time.

Nov 18 '05 #9

P: n/a
Putting the reference does nothing other than creating a variable. It is
never set and cannot be used.
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:12*****************************@phx.gbl...
A. No support for absolute positioning of the control.

You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.
B. No reference to the control in the VB codebehind page.


This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.

HTH,
Suresh.
-----Original Message-----
Ok guys thank for the help. Let me explain what I have

tried.

1. Create a Web User Control within ASP project.
2. Add GridFlow panel and add controls within
3. Drag WUC to the asp page I want to have the control

on.

Now the problems commence.

A. No support for absolute positioning of the control.
B. No reference to the control in the VB codebehind page.

So that is useless for my purposes.

Next try.

1. Create Web Control Library

Now the problems commence (already). When I go to add

the web control I can
only add windows form controls. Now the help line on the

New Project dialog
states "A project for creating controls to use in Web

applications". The
problem is that within this project there is no designer

support.

Now after some experimenting I see that if I just say add

new item then the
selections change. MS please please fix VS. Now there

is still no designer
support. What good is an IDE if all you really need is

notepad.

All in all totally useless for RAD.

Lloyd Sheen
.

Nov 18 '05 #10

P: n/a
Ok, I have a work around, (at least until VS2006). I can create the
variable and in the page load do a FindControl to populate it. To place the
control I can create a panel and use this panel to host the control.

Not exactly what you would expect from a "RAD" product.

Thanks to all for their ideas. An composite of all those ideas was the
parent of the solution.
Lloyd Sheen
Nov 18 '05 #11

P: n/a
Actually it does. The var must have exactly the same name as that in the
..ASPX/.ASCX html page and should be declared at least as protected or
higher. This works perfectly in C#, but I can't say for VB.

As for your gripes about the product, maybe you should seek some training so
as to reduce the learning curve a little. If you are a MSDN subscriber, be
sure to get the "Whidbey" CD released at October's PDC. The ASP.NET team is
making huge strides in the design-time experience, and I believe in the
user-control arena that you'll probably want to check out.

Jeffrey
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:l0******************@news01.bloor.is.net.cabl e.rogers.com...
Putting the reference does nothing other than creating a variable. It is
never set and cannot be used.
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:12*****************************@phx.gbl...
A. No support for absolute positioning of the control.

You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.
B. No reference to the control in the VB codebehind page.


This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.

HTH,
Suresh.
-----Original Message-----
Ok guys thank for the help. Let me explain what I have

tried.

1. Create a Web User Control within ASP project.
2. Add GridFlow panel and add controls within
3. Drag WUC to the asp page I want to have the control

on.

Now the problems commence.

A. No support for absolute positioning of the control.
B. No reference to the control in the VB codebehind page.

So that is useless for my purposes.

Next try.

1. Create Web Control Library

Now the problems commence (already). When I go to add

the web control I can
only add windows form controls. Now the help line on the

New Project dialog
states "A project for creating controls to use in Web

applications". The
problem is that within this project there is no designer

support.

Now after some experimenting I see that if I just say add

new item then the
selections change. MS please please fix VS. Now there

is still no designer
support. What good is an IDE if all you really need is

notepad.

All in all totally useless for RAD.

Lloyd Sheen
.


Nov 18 '05 #12

P: n/a
Jeffrey,
I have been using the MS visual tools since VB1. The biggest problem
with the new VS is that the docs are not up to the task. I have been
compiling of a list of problems with the release and the wait until the next
release is getting a little old.

There are way too many things in the IDE that just don't do the job. I
first set out to learn the .NET framework which has good docs and I was
pleased by the classes which took care of many of the needs that I have been
used to coding myself.

What level of MSDN is required to get the Whidbey "beta". I have
Enterprise and see nothing in any of the categories about it.

Lloyd
"Jeffrey Huntsman" <jhuntsman@__nospam__teletracking.com> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
Actually it does. The var must have exactly the same name as that in the
.ASPX/.ASCX html page and should be declared at least as protected or
higher. This works perfectly in C#, but I can't say for VB.

As for your gripes about the product, maybe you should seek some training so as to reduce the learning curve a little. If you are a MSDN subscriber, be
sure to get the "Whidbey" CD released at October's PDC. The ASP.NET team is making huge strides in the design-time experience, and I believe in the
user-control arena that you'll probably want to check out.

Jeffrey
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message news:l0******************@news01.bloor.is.net.cabl e.rogers.com...
Putting the reference does nothing other than creating a variable. It is never set and cannot be used.
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:12*****************************@phx.gbl...
>A. No support for absolute positioning of the control.
You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.

>B. No reference to the control in the VB codebehind page.

This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.

HTH,
Suresh.

>-----Original Message-----
>Ok guys thank for the help. Let me explain what I have
tried.
>
>1. Create a Web User Control within ASP project.
>2. Add GridFlow panel and add controls within
>3. Drag WUC to the asp page I want to have the control
on.
>
>Now the problems commence.
>
>A. No support for absolute positioning of the control.
>B. No reference to the control in the VB codebehind page.
>
>So that is useless for my purposes.
>
>Next try.
>
>1. Create Web Control Library
>
>Now the problems commence (already). When I go to add
the web control I can
>only add windows form controls. Now the help line on the
New Project dialog
>states "A project for creating controls to use in Web
applications". The
>problem is that within this project there is no designer
support.
>
>Now after some experimenting I see that if I just say add
new item then the
>selections change. MS please please fix VS. Now there
is still no designer
>support. What good is an IDE if all you really need is
notepad.
>
>All in all totally useless for RAD.
>
>Lloyd Sheen
>
>
>.
>



Nov 18 '05 #13

P: n/a
PS. Thanks for the help. Setting the variable to the correct name fixed
the problem. Now if only that were documented. If it were not for the help
of the people on this newgroup I would have no hair left from all the
scratching.

Lloyd
"Jeffrey Huntsman" <jhuntsman@__nospam__teletracking.com> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
Actually it does. The var must have exactly the same name as that in the
.ASPX/.ASCX html page and should be declared at least as protected or
higher. This works perfectly in C#, but I can't say for VB.

As for your gripes about the product, maybe you should seek some training so as to reduce the learning curve a little. If you are a MSDN subscriber, be
sure to get the "Whidbey" CD released at October's PDC. The ASP.NET team is making huge strides in the design-time experience, and I believe in the
user-control arena that you'll probably want to check out.

Jeffrey
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message news:l0******************@news01.bloor.is.net.cabl e.rogers.com...
Putting the reference does nothing other than creating a variable. It is never set and cannot be used.
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:12*****************************@phx.gbl...
>A. No support for absolute positioning of the control.
You are right. VS.NET ide doesn't seem to support
absolute positioning for a user control. I'm not sure if
there's a setting that'll allow you to control that.
But a possible workaround is to place a control that does
absolute positioning such as a Label and place it in the
form where you want the control. Then take the Style
property text and place it inside your user control.
Hopefully someone here has a more elegant way.

>B. No reference to the control in the VB codebehind page.

This is because the object doesn't get declared in the
codebehind automatically. You have to manually add it.
It should be like the following.

Protected <YourUserControlClassName> <IDofyouUserControl>

That should create the reference in your codebehind.

HTH,
Suresh.

>-----Original Message-----
>Ok guys thank for the help. Let me explain what I have
tried.
>
>1. Create a Web User Control within ASP project.
>2. Add GridFlow panel and add controls within
>3. Drag WUC to the asp page I want to have the control
on.
>
>Now the problems commence.
>
>A. No support for absolute positioning of the control.
>B. No reference to the control in the VB codebehind page.
>
>So that is useless for my purposes.
>
>Next try.
>
>1. Create Web Control Library
>
>Now the problems commence (already). When I go to add
the web control I can
>only add windows form controls. Now the help line on the
New Project dialog
>states "A project for creating controls to use in Web
applications". The
>problem is that within this project there is no designer
support.
>
>Now after some experimenting I see that if I just say add
new item then the
>selections change. MS please please fix VS. Now there
is still no designer
>support. What good is an IDE if all you really need is
notepad.
>
>All in all totally useless for RAD.
>
>Lloyd Sheen
>
>
>.
>



Nov 18 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.