You receive a run-time error message when you try to access the properties that are programmatically exposed by the IWebPart interface (911715)
The information in this article applies to:
SYMPTOMSConsider the following scenario. You have a Microsoft ASP.NET 2.0-based application. You try
to use properties of an ASP.NET server control that is located in a WebPartZone control. You use any one of the
System.Web.UI.Webcontrols.WebParts.IWebPart properties on the ASP.NET server
control. In this scenario, you receive the following run-time error message:
Type ControlName does
not have a public property named PropertyName. You may experience this issue when one of the following conditions is true: - You try to access the properties that are programmatically exposed by the IWebPart interface.
- You declare the properties on the control when the control is in a WebPartZone control.
CAUSEThis issue may occur when any one of the following
conditions is true:
- The ASP.NET server control does not implement the
IAttributeAccessor interface.
- The ASP.NET server control does not inherit the
IAttributeAccessor interface from another control that implements the
interface.
The IAttributeAccessor interface is required to support expando properties, and all the
IWebPart properties of the ASP.NET server control are expando properties.
Expando properties are properties that can be added and removed dynamically at run time. WORKAROUNDTo work around this issue, you must wrap the control that
does not implement the IAttributeAccessor interface in a user control. Then add the user control to
a WebPartZone control. Because the System.Web.UI.UserControl class implements the IAttributeAccessor interface and the IAttributeAccessor interface allows for expando properties, you can then use the IWebPart properties on the control that is contained in the
user control.REFERENCESFor more information about the .NET Framework Class Library
IWebPart properties, visit the following Microsoft Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 2/14/2006 |
---|
Keywords: | kbtshoot kbprb KB911715 kbAudDeveloper kbAudITPRO |
---|
|