Please help with user controls

Discussion in 'ASP .Net' started by Lloyd Sheen, Dec 11, 2003.

  1. Lloyd Sheen

    Lloyd Sheen Guest

    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.
     
    Lloyd Sheen, Dec 11, 2003
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:GH1Cb.11942$...
    > 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.
    >
    >
     
    Jesse Liberty, Dec 11, 2003
    #2
    1. Advertising

  3. Lloyd Sheen

    Suresh Guest

    ..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/quickstart/aspplus/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.
    >
    >
    >.
    >
     
    Suresh, Dec 11, 2003
    #3
  4. 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" <> wrote in message
    news:GH1Cb.11942$...
    > 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.
    >
    >
     
    Alex Papadimoulis, Dec 11, 2003
    #4
  5. Lloyd Sheen

    Lloyd Sheen Guest

    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" <> wrote in message
    news:028401c3c00f$72e74f30$...
    > .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/quickstart/aspplus/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.
    > >
    > >
    > >.
    > >
     
    Lloyd Sheen, Dec 11, 2003
    #5
  6. Lloyd Sheen

    Lloyd Sheen Guest

    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
     
    Lloyd Sheen, Dec 11, 2003
    #6
  7. Lloyd Sheen

    Suresh Guest

    >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
    >
    >
    >.
    >
     
    Suresh, Dec 11, 2003
    #7
  8. Lloyd Sheen

    Lloyd Sheen Guest

    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.
     
    Lloyd Sheen, Dec 11, 2003
    #8
  9. 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" <> wrote in message
    news:b74Cb.12936$...
    > 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.
    >
    >
    >
     
    Alex Papadimoulis, Dec 11, 2003
    #9
  10. Lloyd Sheen

    Lloyd Sheen Guest

    Putting the reference does nothing other than creating a variable. It is
    never set and cannot be used.


    "Suresh" <> wrote in message
    news:1234d01c3c020$2e196ad0$...
    > >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
    > >
    > >
    > >.
    > >
     
    Lloyd Sheen, Dec 11, 2003
    #10
  11. Lloyd Sheen

    Lloyd Sheen Guest

    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
     
    Lloyd Sheen, Dec 11, 2003
    #11
  12. 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" <> wrote in message
    news:l05Cb.13070$...
    > Putting the reference does nothing other than creating a variable. It is
    > never set and cannot be used.
    >
    >
    > "Suresh" <> wrote in message
    > news:1234d01c3c020$2e196ad0$...
    > > >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
    > > >
    > > >
    > > >.
    > > >

    >
    >
     
    Jeffrey Huntsman, Dec 12, 2003
    #12
  13. Lloyd Sheen

    Lloyd Sheen Guest

    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:...
    > 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" <> wrote in

    message
    > news:l05Cb.13070$...
    > > Putting the reference does nothing other than creating a variable. It

    is
    > > never set and cannot be used.
    > >
    > >
    > > "Suresh" <> wrote in message
    > > news:1234d01c3c020$2e196ad0$...
    > > > >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
    > > > >
    > > > >
    > > > >.
    > > > >

    > >
    > >

    >
    >
     
    Lloyd Sheen, Dec 12, 2003
    #13
  14. Lloyd Sheen

    Lloyd Sheen Guest

    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:...
    > 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" <> wrote in

    message
    > news:l05Cb.13070$...
    > > Putting the reference does nothing other than creating a variable. It

    is
    > > never set and cannot be used.
    > >
    > >
    > > "Suresh" <> wrote in message
    > > news:1234d01c3c020$2e196ad0$...
    > > > >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
    > > > >
    > > > >
    > > > >.
    > > > >

    > >
    > >

    >
    >
     
    Lloyd Sheen, Dec 12, 2003
    #14
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    541
    Chris Uppal
    May 5, 2005
  2. KK
    Replies:
    2
    Views:
    646
    Big Brian
    Oct 14, 2003
  3. MuZZy
    Replies:
    7
    Views:
    1,785
    Mike Hewson
    Jan 7, 2005
  4. Faizan Ahmed
    Replies:
    1
    Views:
    299
    John Saunders
    Jan 4, 2005
  5. Faizan Ahmed
    Replies:
    1
    Views:
    377
    John Saunders
    Jan 4, 2005
Loading...

Share This Page