side-by-side layout, please (willing to filter!) RRS feed

  • Question

  • User-380708829 posted


    I just came across this forum (formerly discovered the mobile section of the asp.net website) and really appreciate having the possibility of getting some answers now!

    Well, as the title may already have told you, the questions are about mobile pages layout model. While consuming the MSDN article "Organizing Content with Containers", I had to read the following paragraph:

    Controls are placed on a MobilePage in sequential order. This is different from ASP.NET Web pages, which support side-by-side controls and absolute positioning of controls. Because of the wide range of hardware devices that ASP.NET mobile controls support, applications cannot guarantee the side-by-side layout of controls. This is particularly true on WML devices. However, many of the ASP.NET mobile controls expose a BreakAfter property. For most devices, especially those supporting HTML, setting this property to false causes the next control to start on the same line.

    Uhh, no side-by-side? I mean, it doesn't sound like "no side-by-side for a crappy nokia 5110 with cracked firmware to make it wap-enabled" - It more sounds like "no side-by-side at all!". (Question 1:) Is that really true? I have been looking for work-arounds (for instance, using an ObjectList, add the table with ordinary html tags (like <table />, <tr /> and <td />) and other nasty stuff (alignment tricks and such) but didn't manage to render my pages content as I want it to.

    The layout I'm looking for basically is similar to the one of youtubes wap-page (which is, a table consisting of two columns, of which one contains an image while the other one contains some text). I don't want to break down all that cool functionality provided by the mobile namespace but well, I can't create a page without this specific layout. I did understand that some devices will not be able to render tables all together. Thats fine for me. I would love to create another, non-side-by-side layout for those devices. But just because some of the devices want to party like 1999, it's not a reason for all the modern devices to do so too.

    And now (finally!) the primary questions: Did anyone EVER managed to realize such a (device filter aware) layout, which provides beautiful tables for the devices capable of rendering them and this funny looking sequential layout for any other device (without breaking down anything essential)? If so, what approach did you take? Where should I start at? It seems to me as if the only possibility to get a somewhat clean solution is authoring a mobile table control myself (although this probably would be way too much work), what do you think?!

    Thank you guys in advance,


    Wednesday, October 15, 2008 11:37 AM


  • User-380708829 posted

     Just for your interest:

     As nobody wanted to/could  answer my questions, I decided creating a table control myself. For those of you who find this post while searching a solution for a similar problem, I'll give a quick breakdown on what one could do to get it done...

    1. Derive three classes from MobileControl class (Table, TableRow and TableCell) 
    2. Derive three other classes from MobileControlBuilder (TableControlBuilder, TableRowControlBuilder, TableCellControlBuilder)
    3. Now (if you want to have a "clean" solution) create two specialized collections for TableRow and TableCell (although they must not be generic)
    4. Read a lot of msdn articles about ControlBuilders and such - maybe have a look at the mono implementation of the default asp.net Table Control (helps a lot!)
    5. Create the adapters for the targeted languages (in my case, I had to implement nine classes: HtmlTableAdapter, HtmlTableRowAdapter, HtmlTableCellAdapter and the same for Wml and Xhtml)
    6. Associate the adapters with the controls you've just created (in the web.config)
    7. Make it work! :-)

    It's quiet some work but should be done (rudimentary) within 6 hours (at max!!!) and is definitely worth the time.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 17, 2008 7:08 AM