Multiple User Controls

Discussion in 'ASP .Net Web Controls' started by Steven Clark, May 6, 2007.

  1. Steven Clark

    Steven Clark Guest

    Hi

    Hope someone can help.

    I wish to use the same user control, twice on the one page but everytime I
    do it things go wrong.

    This control is my own custom version of the ad-rotator which query's a
    database to return a random image. The control has 3 public properties...
    height, width & Filter. The control will exist inside another user control
    i.e. I have a control for the header and another for the side bar and this
    control will appear in both and then on a master page.

    Every time I do this, the first ad user control on the page sets itself to
    the same values as the second control on the page. I have tried placing the
    controls manually and loading progmatically but with no luck.


    I have tried the following:

    <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    TagPrefix="uc1" %>
    <uc1:adRotator id="AdRotator1" runat="server" Height="72px" Width="392px"
    filter="T"></uc1:adRotator>
    <uc1:adRotator id="AdRotator2" runat="server" Height="240px" Width="120px"
    filter="T"></uc1:adRotator>

    and
    <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    TagPrefix="uc1" %>
    <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    TagPrefix="uc2" %>
    <uc1:adRotator id="AdRotator1" runat="server" Height="72px" Width="392px"
    filter="T"></uc1:adRotator>
    <uc2:adRotator id="AdRotator2" runat="server" Height="240px" Width="120px"
    filter="T"></uc2:adRotator>

    Please let me know if you need any more code extracts.

    I hope you can help.

    Steven
     
    Steven Clark, May 6, 2007
    #1
    1. Advertising

  2. "Steven Clark" <> wrote in message
    news:...
    > Hi
    >
    > Hope someone can help.
    >
    > I wish to use the same user control, twice on the one page but everytime I
    > do it things go wrong.
    >
    > This control is my own custom version of the ad-rotator which query's a
    > database to return a random image. The control has 3 public properties...
    > height, width & Filter. The control will exist inside another user
    > control i.e. I have a control for the header and another for the side bar
    > and this control will appear in both and then on a master page.
    >
    > Every time I do this, the first ad user control on the page sets itself to
    > the same values as the second control on the page. I have tried placing
    > the controls manually and loading progmatically but with no luck.
    >
    >
    > I have tried the following:
    >
    > <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    > TagPrefix="uc1" %>
    > <uc1:adRotator id="AdRotator1" runat="server" Height="72px" Width="392px"
    > filter="T"></uc1:adRotator>
    > <uc1:adRotator id="AdRotator2" runat="server" Height="240px" Width="120px"
    > filter="T"></uc1:adRotator>
    >
    > and
    > <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    > TagPrefix="uc1" %>
    > <%@ Register Src="../components/adRotator.ascx" TagName="adRotator"
    > TagPrefix="uc2" %>
    > <uc1:adRotator id="AdRotator1" runat="server" Height="72px" Width="392px"
    > filter="T"></uc1:adRotator>
    > <uc2:adRotator id="AdRotator2" runat="server" Height="240px" Width="120px"
    > filter="T"></uc2:adRotator>


    Do you have any static (Shared in VB.NET) data? If so, that data would be
    shared between the two instances of the control.
    --
    John Saunders [MVP]
     
    John Saunders [MVP], May 6, 2007
    #2
    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. trinitypete

    HTML Controls and User controls

    trinitypete, Jun 25, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    3,466
    trinitypete
    Jun 26, 2003
  2. Jeff Tolman
    Replies:
    0
    Views:
    3,045
    Jeff Tolman
    Nov 4, 2003
  3. Nathan Sokalski
    Replies:
    4
    Views:
    1,171
    Muhammad Naveed Yaseen
    Sep 5, 2007
  4. Faizan Ahmed
    Replies:
    1
    Views:
    311
    John Saunders
    Jan 4, 2005
  5. Faizan Ahmed
    Replies:
    1
    Views:
    390
    John Saunders
    Jan 4, 2005
Loading...

Share This Page