Skip navigation.

The Myth of ScrollingAll recent postsLegacy XhtmlConformance Kills Partial Page Updates

Absolute Positioning of Controls in VS 2008: Forget It Exists!

Mikhail Arkhipov has recently posted a tip how to drag a control in VS 2008 and have it absolutely positioned on a web page. Here’s my advice: forget this feature exists! Here’s why.

There existed a hideous MS_POSITIONING attribute some time ago which allowed the VS 2003 designer to drag and drop server controls on a page and position them via the position: absolute CSS rule. My suggestion then was, and still is, to avoid this practice. Don’t get sweet-talked into designing WebForms the same way as WinForms. They differ in just about everything: state, execution environment, interactivity, control over layout, threading, etc.

Another important point here is: form follows function. Dragging server controls and dropping them in arbitrary spots is backward thinking.

Consider page structure first. Put building blocks where they are supposed to be. Endow them with function. The CSS Zen Garden is exactly that: one page with intended structure, first; various presentations, second.

A lot of articles and books have been written on this subject including several sections in Andy Clarke’s Transcending CSS.

Comments

Comment permalink 1 Josh Stodola |
Couldn't agree with you anymore with your comment about "backward thinking", and I've been telling people the same thing. In fact, I would never use the designer to layout page, period.

http://forums.asp.net/p/1160345/1916616.aspx
Comment permalink 2 curious |
[Josh Stodola]
> never use the designer to layout page

What designer are we talking about? A human designer or the Visual Studio "designer?"
Comment permalink 3 Milan Negovan |
Yes, I believe Josh was talking about the Visual Studio designer. I never use it either.
Comment permalink 4 Kent Boogaart |
Agreed. To me, designer tools are useful as a preview mechanism only (and most aren't even very good at that). This is true back when I did ASP.NET but also now when doing WPF (although for slightly different reasons).

Winforms is an exception. When the winforms designer actually works (rare) I will use it simply because the alternative is writing a heap of mundane code.

As for human designers, I would *love* to have a good graphic and UI designer working with me on *any* project. However, it has been my experience that corporations just don't see the need / won't foot the bill for them. It's like getting a mechanic to paint your car.
Comment permalink 5 Shamunda |
Oh stop it..that is the way of old...It's a new Gen of development now which for the most part works just about everywhere. Absolute position is no harmful today as when all the other new technologies emerged.

Use it, love, embrace it.

New Dawn.

-Sham
Comment permalink 6 Milan Negovan |
This feature in no way encourages proper usage of absolute positioning so I expect a lot of people will mindlessly drag stuff around the screen. This is a wrong approach, which was my point up there.
Comment permalink 7 Dean Hiller |
As with everything, there is a balance. Right now, I have a client who wants cheap, and sometimes dragging everything over the place just gets the job done. the client is aware that this may require rework later but they don't care...I end up spending less time on the job and charging less for it then. They want it faster and cheaper. That is business 101...make the customer happy, not design the perfect system. So as far as arguing vs. pure clean div's all over or just one big sheet of paper where everything absolutely positioned, the answer is (as it almost always is) "it depends". Context is everything. I myself love pure divs and love being able to redo my design without touching my html. In practice though, there are not many designers in China who can do that which I can't STAND by the way. Even in the US, I have trouble finding those good ones and usually they are really expensive since they are so rare. I do have one rare designer in China that has this skill for 30USD/ hour which is more expensive than I even charge for my developers(OUCH!!!). I had her do my website though with all divs(http://xsoftware.biz)
Comment permalink 8 Dean Hiller |
I forgot to mention, when I do use absolute positioning, I still group things in absolute positioned divs so a graphic designer can style it later without touching the html(except they have to add the id or class attributes to the divs of course). Works wonders for speed when you need it.
Comment permalink 9 Sebastian Mueller |
For content management and internet the absolute position feature is not worth to mention, but we are also developing industry web solutions, where we create pages that show a part of an industry factory. Here we need absolute position for elements. And we need alignment functionality for multiple elements that also lacks in VS 2008. We know it is proprietary, but for this intranet solution its the best way to do it.
Comment permalink 10 domsysrs |
This is the biggest pile of bullshit I have ever heard! There are two types of people in this world: programmers and those who really get work done. In 45 years as a programmer, every programmer I have ever worked with truly believes this;"programming is a rarified art that is only understood by a select few of us. Until you get to be as smart as we are, just shut your mouth and open your wallet to buy us more programming toys and just do what we tell you. When the programmers Hall of Fame is created I will be the first inductee!!!!" Putting together forms that make no sense to anyone but a stupid programmer is hat a programmer is hired to do! "Those who really get work done" want forms that make sense from a business perspective - to hell with what programmers want!
Comment permalink 11 Grant Anderson |
I partially agree with the append by domsysrs. I note that seemingly in every profession the majority of people tend (or pursue) complexity either as a subconscious infatuation with it and/or because it increases their job security through guru-hood. The complexity level in programming nowadays, especially web programming, is very (too) high. Referring to a previous append where they had to bring in a designer to get the site looking right...Isn't this a little extreme (and absurb) that this is a COMMON need/requirement? Weren't computers (and software) supposed to make things simpler? Why is software (and now the law, taxes, etc) so excessively complex? Why can't one with just basic knowledge build a web database app in a couple of hours without having to munge code?

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):