Properties from Base Page Class missing in VS2005
There was a design change to the web sites in Visual Studio 2005 in which properties for custom base page classes are not parsed at design time. The result of this change is that the properties are not displayed in the Properties pane and you cannot debug any design time based code in your base class.
The only workaround to getting your properties to display is to modify the page_directive.xsd file at c:\Program Files\Microsoft Visual Studio 8\Common7\Packages\schemas\html. It's a good idea to back-up the schemas first incase you make a typo, but it's relatively easy to add additional properties to the XSD. This will give you intellisense on those properties, and stop any squiggles.
To add a bool named CustomBoolAttributeDef:
<xsd:schema...>
<xsd:complexType name="PageDef">
...xsd:attribute tags...
<xsd:attribute name="CustomBoolAttribute" type="CustomBoolAttributeDef" vs:nonfilterable="true" />
</xsd:complexType>
<xsd:simpleType name="CustomBoolAttributeDef">
<xsd:restriction base="xsd:bool">
<xsd:enumeration value="True" />
<xsd:enumeration value="False" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Once you add the property to the schema, it will become available in the property grid when a page is open. The down-side is that the property will always show up even on pages that don't inherit from your base class. However, if a user enters a value and the base class is not in use, the setting is ignored. Another side effect of the change is that the custom base class is not instantiated in the designer. This means that you cannot debug design time behavior that occurs in your page base class. You can still set breakpoints and debug the page base class at runtime.
Comments
- Anonymous
February 09, 2006
This is causing me enormous pain, as my design-time subclassed user controls call methods on the subclassed page on which they are hosted.
This worked great in VS 2003. How can I get VS 2005 to create the correct type?
I can not believe that this functionality is just gone.