Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How do *you* align your controls? (ASP.NET)

Options
  • 05-07-2006 3:56pm
    #1
    Closed Accounts Posts: 4,943 ✭✭✭


    Just wondering what people use to align their controls. Lots of <div>'s, Panels, Tables? Whats the preferred method.

    What i was told is to put everything in tables as that way you can align things easily. Is this really the best way? Quite often i can end up with three or four layers of table, and it just gets so horribly messy (imo). Getting the controls into the right layout can be hard because of that.


Comments

  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Just wondering what people use to align their controls.

    I use other developers.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    bonkey wrote:
    I use other developers.
    And do those developers use other developers too? Or do they use specialised outsourcing techniques to create the layout? :rolleyes:


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Personally I use tables and nested tables. Probably not the best way to do it but its generally the SOP in the companies I work for.

    Ask over on the webmaster forum for a better alternative. And then spit at them. Damn them artistic types and their berets, damn them.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I prefer tables myself. Even without nesting one table with some colspans and rowspans can work very well. I find panels usefull if I have a few controls I want to hide untill some event or other but wouldn't try any complicated layout with them.

    I tried some position: absolute CSS before (with old ASP), the less said about that the better :)


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    I've seen *high* design work in classic asp using xml/xsl. Anybody encountered this with asp.net? Wouldn't mind getting to know more about it.


  • Advertisement
  • Registered Users Posts: 3,548 ✭✭✭Draupnir


    It all depends on what kind of browsers you want to support. For cross browsers compatibilty, you need to be going with divs and tables in a combination.

    Tables should be used sparingly though.

    I like to use css for as much as possible.


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    1] Is it an inetrnet or intranet application
    if the former spacer gifs and tables are theway to go because you just don't know.

    http://www.websiteoptimization.com/speed/tweak/structure/


  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    Tables should never be used for page layout. Use divs and css. Check the WCAG for reasons why.


  • Registered Users Posts: 3,548 ✭✭✭Draupnir


    Tables should never be used for page layout.

    Thats just web naziism in my opinion. There are always cases, particularly with web controls in asp.net that you will need to use tables because div's dont quite line things up as you would like.


  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    Well Ok, never might be a bit of a strong word, but it is generally accepted that using tables for page layout is bad practice and should be avoided wherever possible.


  • Advertisement
  • Registered Users Posts: 3,548 ✭✭✭Draupnir


    I completely agree with you on that score muckwarrior.


  • Closed Accounts Posts: 14 GiantCranes


    I try to use divs when possible, but sometimes find myself struggling with CSS for hours trying to get the layout that I want in both major browsers. Tables are the fall back for me.


  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    I try to use divs when possible, but sometimes find myself struggling with CSS for hours trying to get the layout that I want in both major browsers. Tables are the fall back for me.
    Yeah, I went through teh same experience, but once you get the hang of it I think it's actually easier using CSS and divs. It also produces much more readable code IMO.


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    I'm one of those people who'll use tables, but I can see why they say to use CSS and div tags - and it's not web nazi-ism.

    From playing with some CMSs, you can just drop in different style sheets if you need the data to be displayed differently. If you use tables, you have a lot more work to do, because everything is interlaced. You have layout information right in the middle of your data. So CSS allows for easier swapping and switching.

    That said, I never got the hang of CSS, so I tend to use tables :P


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    First question I would ask is what controls specifically are you trying to align. Most .Net controls spit out a table as it is.
    Basically I would consider it standard by now to use divs for my page design, 2 column, 3 column etc. Then if I am displaying tabular data it goes into the main div in a gridview using all accessability features available. I normally use the repeater for simple databinding so I can control the output, for example to an unordered list.
    The only common aligning problem I can imagine might be with a master-detail scenario with a gridview and a detailsview and you want the gridview taking up the left hand side of the page and detailsview the right-hand side showing detailed info when an item is selected in the gridview. I tend to take the easy way out and put the details view on a seperate page. Not suited to all situations.


  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    From playing with some CMSs, you can just drop in different style sheets if you need the data to be displayed differently. If you use tables, you have a lot more work to do, because everything is interlaced. You have layout information right in the middle of your data. So CSS allows for easier swapping and switching.
    This is just one of many positive side effects of using CSS for layout, but the main reason why it is officially bad practice to use tables is lack of accessibility. Basically tables wreak havok with screen readers and often leaves a page totally unreadable.


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m




  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    Ph3n0m wrote:
    Care to explain?
    The only reference I could find to tables in that article is where the author seems to disagree with the new WCAG loosening it's stance on tables for layout.


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    Basically that tables can still be used as long as they are clearly identified, using header, footer and summaries

    For example bbc.co.uk prides itself on being accessible, etc - and yet they still use tables throughout their site


  • Registered Users Posts: 431 ✭✭plenderj


    What's the problem with tables? :confused:

    I'm gonna jump in with my size-MVP boots on this one ;)


  • Advertisement
  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    plenderj wrote:
    What's the problem with tables? :confused:

    I'm gonna jump in with my size-MVP boots on this one ;)


    LOL there is nothing wrong with tables. Its just a near pathological obsession in relation to websites, that to be accessible to screen readers, etc that you could not use tables - or only use them for layout of data.

    However, despite what some people believe, tables can still be used effectively and are usable by screen readers, etc.

    There is a whole arguement for and against tables - it will never be resolved immediately.

    Tables and/or divs are good - use whatever you want :)


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    At the end of the day Tables were and are intended for displaying tabular data and there are methods for ensuring tabular data is readable by screen readers by indicating the individual columns.

    Tables became popular for layout because it was pretty easy especially with the WYSIWYG editors making it even easier. Unfortunately WCAG 2 appears to be have decided not to push the idea of not using tables for layout.

    Doing away with tables for layout is about reducing the size of your html pages, reducing the size of your bandwidth costs, improving the experience for the user, making it easier on screen reads by using semantically correct html that makes sense not only to those screen readers but to search engine bots that can more easily discern what part of your html is what because it makes sense. i.e. the main content of your page is not the 3rd td in the 2nd tr down but in a div with an id of maincontent for example.

    Of course nothing stops you from using tables for layout but it's worth looking at the alternative now and discovering how easy it is in reality not to mention having the skill that is more likely to be in demand.

    The BBC site aims to provide accessability by offering text only versions of their pages from what I can see. Their site is excellent but when you consider they are still using font tags then their html may not be the best example.


Advertisement