• Sign In
 
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...
Common Tasks
  • Blog Home
  • Email Blog Author
  • RSS for comments
  • RSS for posts
Search
  • Advanced search options...
Tags
  • .NET Framewor
  • .NET Framework
  • Ajax/Javascript
  • ASP.NET
  • CLR
  • Cool stuff
  • DataAccess
  • Debugging/Windbg
  • Hotfix/Service Pack
  • IDEVDataCollector
  • IIS
  • Internet Explorer
  • Italian techs
  • LogParser
  • OT
  • Personal
  • Productivity
  • Random
  • Scripting/ASP
  • Security
  • Technology
  • Tools
  • Troubleshooting
  • Vista/Longhorn
  • Visual Studio
Archives
Archives
  • November 2010 (1)
  • October 2010 (1)
  • July 2010 (2)
  • April 2010 (1)
  • March 2010 (2)
  • February 2010 (2)
  • January 2010 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (1)
  • July 2009 (5)
  • June 2009 (1)
  • May 2009 (1)
  • April 2009 (3)
  • March 2009 (3)
  • February 2009 (5)
  • January 2009 (3)
  • December 2008 (5)
  • November 2008 (3)
  • October 2008 (2)
  • September 2008 (3)
  • August 2008 (3)
  • July 2008 (3)
  • June 2008 (5)
  • May 2008 (4)
  • April 2008 (8)
  • March 2008 (4)
  • February 2008 (5)
  • January 2008 (2)
  • December 2007 (4)
  • November 2007 (6)
  • October 2007 (6)
  • September 2007 (8)
  • August 2007 (6)
  • July 2007 (7)
  • June 2007 (10)
  • May 2007 (9)
  • April 2007 (12)
  • March 2007 (8)
  • February 2007 (5)
  • January 2007 (3)
  • December 2006 (1)
  • November 2006 (4)
  • October 2006 (2)
  • September 2006 (9)
  • August 2006 (2)
  • July 2006 (1)

TabContainer rendered incorrectly in Design View

MSDN Blogs > Never doubt thy debugger > TabContainer rendered incorrectly in Design View

TabContainer rendered incorrectly in Design View

Carlo Cardella
5 Jan 2009 1:19 PM
  • Comments 7

One of the (very few) downsides I see working in Customer Support is that most of the times when talking to colleagues and friends or writing a new post for my blog, I find myself talking about problems, bugs, exceptions… what is not working fine, like a doctor most of the times has to deal with malaises and diseases. Anyway the good part is that most of the times we are able to find the solution to those problems, or at least we can alleviate them.

This is the case of a problem I had with the Ajax TabContainer control which is not displayed correctly in Design View, where the Tab caption is not completely visible, as in the screenshot here below:

Tab caption not completely visible

But if we open the page in a real browser, it displays correctly:

Tabs displaied correctly in browser

This is part of a problem reported on the Connect site some time ago: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=322477.

This has to do with the !DOCTYPE (Document Type Definition, or DTD), which among other things influences how CSS styles, formatting and positioning are applied to the page and its UI elements. With DTD we can control IE’s strict standard compliance; for example in this case if we remove the DTD from the source code in Visual Studio, then the TabContainer control and its Tabs are displayed correctly:

Tab caption rendered correctly without DTD

But this just moves the problem to the real browser, where without strict compliance mode IE fails to render the tabs correctly:

Tab wrong in browser without DTD

Visual Studio uses it own rendering engine to show pages and controls in Design View, and this is the component which does not handles compatibility mode correctly; this is a known issue and as of now I know this problem is scheduled to be fixed in Visual Studio 2010, there is no plan for a fix for the current Visual Studio version.

Anyway this real problem here is the difficulty to click on the Tab caption to switch between tabs at design time; other than that I’ve not heard or other issues but feel free to correct me if I’m wrong. So, if that is the real issue, a simple workaround a suggested to the customer is to select the TabContainer control and then in the “Properties” grid you can change the ActiveTabIndex value and press ENTER: this will give focus to the Tab you selected. Remember that this is a zero based array, so as in the sample here below if you want to switch to TabPanel5 you have to set ActiveTabIndex to 4:

TAB index

 

Hope this helps…

 

Carlo

Quote of the day:
Tact is the knack of making a point without making an enemy. – Isaac Newton
  • 7 Comments
ASP.NET, Visual Studio
Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post
Comments
  • TabContainer rendered incorrectly in Design View | Coded Style
    5 Jan 2009 4:37 PM

    PingBack from http://www.codedstyle.com/tabcontainer-rendered-incorrectly-in-design-view/

  • Cyberyaga
    12 Aug 2009 3:16 PM

    One simple thing that can be done, is to have the DTD place inside a server tag.

    ex. <%= "<!DOCTYPE html PUBLIC \"-//W3C....." %>

    Like that, it won't render in design mode in VS2008, but it will render at runtime on the browser.

    Thanks for the Tip on the cause of the problem... this was driving me mad.

  • Steven
    20 Sep 2009 10:29 PM

    Thanks for the fix.

    I have another issue related with Ajax TabContainer:

    When I select any control placed inside the tabcontainer, it doesn't select the corresponding source code in source view. It selects the code of the whole TabContainer.

    I have 5 TabPanels and many controls in each panel and is difficult to locate the code for each.

    Also I noticed that recently when I do any change in Design View or Properties window, it doesn't change in Source View and the change will be lost. This happens maybe only for the end of the document, for the last TabPanels. Sometimes changing from first few TabPanels still works.

    Is there any limit how long an aspx file should be?

    Thanks,

    Steven

  • Steven
    21 Sep 2009 9:54 PM

    After placing the DTD inside a server tag,

    <%= "<!DOCTYPE html PUBLIC \"-//W3C....." %>

    I had weird compilation errors in some temporary file, not even in my code. The error is in this line:

    @__w.Write("\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");

    The error says ")" missing at the beginning and end of line.

    The file name is "App_Web_dr0e1per.0.cs", but at every try is different, only the App_Web_ is the same.

    Finally I figured out that if I leave the DTD in default format and leave my comments too before the DTD, which looks like:

    <%-- Quick fix for tabcontainer ... -->

    , the Visual Studio shows correctly the TabPanels. I can't understand why but it fixed for me. Sounds very odd that leaving some comments before the DTD can fix the design view.

  • andrew
    9 Nov 2009 10:28 AM

    the comment just before the DTD fixed it for me as well. This is very weird.

  • LGL
    31 Dec 2009 9:21 PM

    Thanks a billion - Great article - Great explanation ... I just "upgraded" to VS2008 from 2005. The Design View is full of rendering oddities like this one. I really wish I had my VS2005 interface back. VS2008 Design View is a DOWNGRADE of the well functioning VS2005 version!

  • gabos81
    13 Sep 2011 9:18 AM

    Thanks about your tips, this really help me, with the ActiveIndex I can move to any tabpanel, thanks again!

Page 1 of 1 (7 items)
  • © 2012 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy Statement
  • Report Abuse
  • 5.6.402.223