Width and Height properties for controls with absolute position

Last post 10-16-2007 3:18 AM by StefanL. 2 replies.

Sort Posts:

  • Width and Height properties for controls with absolute position

    10-15-2007, 7:57 AM
    • Loading...
    • StefanL
    • Joined on 10-15-2007, 7:41 AM
    • Posts 3

    Hi,

    I've been trying out beta2 for a few weeks and ran into a somewhat strange behavior. We have several control classes relying on the Width and Height properties for subcontrol layout. When resizing controls with absolute position in the html designer these properties seem to get cleared and only stored in the style-tag. When using normal positioning the properties are updated. In VS2005 the designer updates Width/Height in both positioning modes.

    Is this behavior by design? Is there a workaround (using custom designers for example)?

    Regards,
    Stefan

  • Re: Width and Height properties for controls with absolute position

    10-15-2007, 6:26 PM
    Answer

    Yes,it is by design since styling using width/height attributes is technically deprecated in favor of CSS. You can specify where to put control dimensions (inline style or class) in Tools | Options | HTML Designer | CSS. You can specify if designer should use width/height for images in Tools | Options | HTML Designer | Misc. For all other elements dimensions are always placed in styles.

    Thanks

    ------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Width and Height properties for controls with absolute position

    10-16-2007, 3:18 AM
    • Loading...
    • StefanL
    • Joined on 10-15-2007, 7:41 AM
    • Posts 3

     Hi,

    Thanks for your answer. You mean that the resulting html sent to the client should use style like "width:400px" instead of width="400"? In that case I totally agree. But my problem is that the server side attributes Width and Height are not set and therefore not accessible from the control code. For example:

    public override Unit Width
    {
        get { return base.Width; }
        set
        {
            base.Width = value;
            // Update child control widths based on parent width calculations
            // ...
        }
    }

    But Width and Height are not changed when the control is resized (if using absolute positions).

    Are the Width and Height properties themselves deprecated and should not be relied upon? In that case - why are they set when non-absolute controls are resized?

    Regards,
    Stefan

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter