Absolute positining of nested custom controls

Discussion in 'ASP .Net Web Controls' started by Nick Stansbury, Apr 19, 2005.

  1. Hi,

    I am trying to produce a series of web controls which will always
    position themselves at the very top left hand corner of the page. However
    I've come across a problem that should have been obvious - which is that
    when the controls are nested several layers deep inside div's (which is
    unavoidable) - up to n-layers deep - they position themselves absolutely -
    but only relative to the top left hand corner of their parent div:

    Now I know that if every div the tree is positioned absolutely I can
    use the offsetParent property in a dhtml function to recurse up the tree and
    add them together to correctly position the div to the top left - however I
    can't find a way of continuing to recurse up the tree using the offset
    parent if any of the div's aren't positioned absolutely.

    Is there an easy way to get around this problem? Am I missing something
    obvious? Can anyone help?

    Thanks

    Nick

    i.e

    <div id=myWebControl1>
    <span>
    Label text:
    </span>
    <input tpe=text>bah</input>
    <div id=mWebControl2>
    <div id=mWebCotrol3> <!-- Take this control and position it
    absolutely to the top left hand corner at 0,0-->
    </div>
    </div>
    </div>
    Nick Stansbury, Apr 19, 2005
    #1
    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. Marius Trælnes

    Nested controls in custom tab control

    Marius Trælnes, Jan 3, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    743
    Henrik Larsen
    Jan 3, 2005
  2. rodchar
    Replies:
    0
    Views:
    379
    rodchar
    Nov 26, 2007
  3. Replies:
    7
    Views:
    329
    George Sakkis
    Apr 11, 2009
  4. Rick Strahl [MVP]

    Custom Controls and Absolute Positioning

    Rick Strahl [MVP], Dec 11, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    125
    Rick Strahl [MVP]
    Dec 11, 2006
  5. James Byrne
    Replies:
    3
    Views:
    542
    James Byrne
    Sep 14, 2010
Loading...

Share This Page