Dynamically position custom control .ascx

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF1bA==?=, Jun 10, 2005.

  1. Hi I have a custom control and am using as a menu on webpages, just wondering
    if there is a way to position it differently on different pages, perhaps some
    code in the page load event?
    thanks,
    --
    Paul G
    Software engineer.
     
    =?Utf-8?B?UGF1bA==?=, Jun 10, 2005
    #1
    1. Advertising

  2. You can use style to change the postion.

    MyControl.styles.Add("position","absolute")
    MyControl.styles.Add("top","20")

    Ibrahim ULUDAG
    www.ibrahimuludag.com




    "Paul" <> wrote in message
    news:...
    > Hi I have a custom control and am using as a menu on webpages, just
    > wondering
    > if there is a way to position it differently on different pages, perhaps
    > some
    > code in the page load event?
    > thanks,
    > --
    > Paul G
    > Software engineer.
     
    Ibrahim ULUDAG, Jun 10, 2005
    #2
    1. Advertising

  3. ok thanks for the information.
    --
    Paul G
    Software engineer.


    "Ibrahim ULUDAG" wrote:

    > You can use style to change the postion.
    >
    > MyControl.styles.Add("position","absolute")
    > MyControl.styles.Add("top","20")
    >
    > Ibrahim ULUDAG
    > www.ibrahimuludag.com
    >
    >
    >
    >
    > "Paul" <> wrote in message
    > news:...
    > > Hi I have a custom control and am using as a menu on webpages, just
    > > wondering
    > > if there is a way to position it differently on different pages, perhaps
    > > some
    > > code in the page load event?
    > > thanks,
    > > --
    > > Paul G
    > > Software engineer.

    >
    >
    >
     
    =?Utf-8?B?UGF1bA==?=, Jun 10, 2005
    #3
  4. Hi I am having trouble accessing the styles attribute of the control, tried
    the following but it does not work. navbar.ascx is the custom control
    Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
    myControl.styles---not recognized
    --
    Paul G
    Software engineer.


    "Ibrahim ULUDAG" wrote:

    > You can use style to change the postion.
    >
    > MyControl.styles.Add("position","absolute")
    > MyControl.styles.Add("top","20")
    >
    > Ibrahim ULUDAG
    > www.ibrahimuludag.com
    >
    >
    >
    >
    > "Paul" <> wrote in message
    > news:...
    > > Hi I have a custom control and am using as a menu on webpages, just
    > > wondering
    > > if there is a way to position it differently on different pages, perhaps
    > > some
    > > code in the page load event?
    > > thanks,
    > > --
    > > Paul G
    > > Software engineer.

    >
    >
    >
     
    =?Utf-8?B?UGF1bA==?=, Jun 10, 2005
    #4
  5. Or try

    MyControl.Attributes.Add("style","position:absolute;top:20px");

    I hope i works.

    Ibrahim ULUDAG
    www.ibrahimuludag.com

    "Paul" <> wrote in message
    news:...
    > Hi I am having trouble accessing the styles attribute of the control,
    > tried
    > the following but it does not work. navbar.ascx is the custom control
    > Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
    > myControl.styles---not recognized
    > --
    > Paul G
    > Software engineer.
    >
    >
    > "Ibrahim ULUDAG" wrote:
    >
    >> You can use style to change the postion.
    >>
    >> MyControl.styles.Add("position","absolute")
    >> MyControl.styles.Add("top","20")
    >>
    >> Ibrahim ULUDAG
    >> www.ibrahimuludag.com
    >>
    >>
    >>
    >>
    >> "Paul" <> wrote in message
    >> news:...
    >> > Hi I have a custom control and am using as a menu on webpages, just
    >> > wondering
    >> > if there is a way to position it differently on different pages,
    >> > perhaps
    >> > some
    >> > code in the page load event?
    >> > thanks,
    >> > --
    >> > Paul G
    >> > Software engineer.

    >>
    >>
    >>
     
    Ibrahim ULUDAG, Jun 11, 2005
    #5
  6. Hi it builds and runs ok but does not seem to move the control around.
    Here is what I have.
    Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
    myControl.Attributes.Add("style", "position:absolute;left:40px")
    --
    Paul G
    Software engineer.


    "Ibrahim ULUDAG" wrote:

    > Or try
    >
    > MyControl.Attributes.Add("style","position:absolute;top:20px");
    >
    > I hope i works.
    >
    > Ibrahim ULUDAG
    > www.ibrahimuludag.com
    >
    > "Paul" <> wrote in message
    > news:...
    > > Hi I am having trouble accessing the styles attribute of the control,
    > > tried
    > > the following but it does not work. navbar.ascx is the custom control
    > > Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
    > > myControl.styles---not recognized
    > > --
    > > Paul G
    > > Software engineer.
    > >
    > >
    > > "Ibrahim ULUDAG" wrote:
    > >
    > >> You can use style to change the postion.
    > >>
    > >> MyControl.styles.Add("position","absolute")
    > >> MyControl.styles.Add("top","20")
    > >>
    > >> Ibrahim ULUDAG
    > >> www.ibrahimuludag.com
    > >>
    > >>
    > >>
    > >>
    > >> "Paul" <> wrote in message
    > >> news:...
    > >> > Hi I have a custom control and am using as a menu on webpages, just
    > >> > wondering
    > >> > if there is a way to position it differently on different pages,
    > >> > perhaps
    > >> > some
    > >> > code in the page load event?
    > >> > thanks,
    > >> > --
    > >> > Paul G
    > >> > Software engineer.
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?UGF1bA==?=, Jun 13, 2005
    #6
    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. John Blair
    Replies:
    2
    Views:
    724
    John Blair
    Jan 29, 2005
  2. David Bowey
    Replies:
    1
    Views:
    460
    Steve C. Orr [MVP, MCSD]
    Mar 16, 2005
  3. osi_nl
    Replies:
    0
    Views:
    1,231
    osi_nl
    Aug 19, 2006
  4. David Bowey

    Best Practices: Porting ASCX control to compiled Custom Control?

    David Bowey, Mar 16, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    184
    Steve C. Orr [MVP, MCSD]
    Mar 16, 2005
  5. James Wong
    Replies:
    4
    Views:
    536
    James Wong
    Jul 14, 2004
Loading...

Share This Page