Microsoft KB Archive/941824

= Error message when you build an ASP.NET 2.0 Web application in Visual Studio 2005: &quot;The base class includes the field ' '&quot; =

Article ID: 941824

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft ASP.NET 2.0
 * Microsoft .NET Framework 2.0

-



SYMPTOMS
Consider the following scenario:  You create a Microsoft ASP.NET 2.0 Web application.  You add markup that resembles the following to the Web page.   You build the application by using Microsoft Visual Studio 2005. You install the Microsoft .NET Framework 3.5. You open the project in Visual Studio 2005 and then build the application.

In this scenario, you receive an error message that resembles the following:

ASP.NET runtime error: The base class includes the field ‘ ’, but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlTableBodySection).



CAUSE
In the .NET Framework 3.5, the following HTML tags no longer map to the HtmlGenericControl class:
 * tbody
 * thead
 * tfoot

In the .NET Framework 3.5, these tags map to the following classes:

This change enables the layout options of the new ListView control.

Note When you install the .NET Framework 3.5, the .NET Framework files in the V2.0.50727 folder are updated. Therefore, when you install the .NET Framework 3.5, Visual Studio 2005 is affected.



RESOLUTION
To resolve this problem, update the Web page so that the HTML tags map to the new classes. You can do this manually. Or, you can use the Visual Studio 2005 designer to do this automatically.

Manual method
To manually resolve this problem, follow these steps: <ol> In Visual Studio 2005, open the .aspx.designer.cs file.

Note The placeholder  represents the name of the Web page on which you encounter the problem.</li> Locate the entries for the tbody, thead, and tfoot tags.</li>  Change the entries to map these tags to the new classes. For example, make the following changes.

Old entry protected global::System.Web.UI.HtmlControls.HtmlGenericControl tbodyname; New entry protected global::System.Web.UI.HtmlControls.HtmlTableBodySection tbodyname; </li> Save the .aspx.designer.cs file.</li></ol>

Automatic method
To automatically resolve this problem by using the Visual Studio 2005 designer, follow these steps:
 * 1) In Visual Studio 2005, open the  .aspx file.

Note The placeholder  represents the name of the Web page on which you encounter the problem.
 * 1) In the Source window, locate the   tags, and then select all entries in the range that includes these tags.
 * 2) On the Edit menu, click Cut. This operation removes the corresponding entries from the  .aspx.designer.cs file.
 * 3) Keep the cursor in the same location.
 * 4) On the Edit menu, click Paste. This operation adds the entries that inherit the new classes back to the  .aspx.designer.cs file.
 * 5) Save the  .aspx file.

<div class="status_section">

STATUS
This behavior is by design.

Keywords: kbtshoot kbprb kbexpertiseadvanced KB941824

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.