PDA

View Full Version : VS designer errors: SupportedFeatures, UserLocale properties


Alistair
05-05-2005, 12:56 AM
Hi

As suggested in another thread, I'm using Spring.Web.UI.Page as the base for my pages. However, when making changes to the page in the designer, I get two Spring related errors:

Code generation for property 'SupportedFeatures' failed. Error was: 'Object reference not set to an instance of an object.'

Code generation for property 'UserLocale' failed. Error was: 'Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive'


I've looked at these properties in the Spring Page class but am not sure what is causing the error. Is there something I need to do in my page, or do these properties not work correctly when being accessed by the designer?

The page I am experimenting with is very simple - I have a couple of TextBox controls on it bound using Spring binding to properties of the page and that's about it.

Thanks
Alistair

Alistair
05-05-2005, 01:13 AM
As a work around, I've added my own base Page class that inherits from Spring.Web.UI.Page and included the following properties:

/// <summary>
/// Gets or sets user's locale
/// </summary>
public override CultureInfo UserLocale
{
get
{
if(Site != null && Site.DesignMode)
{
return CultureInfo.CurrentCulture;
}
else
{
return base.UserLocale;
}
}
set
{
if(Site == null || !Site.DesignMode)
{
base.UserLocale = value;
}
}
}

/// <summary>
/// Gets or sets supported features.
/// </summary>
public new Features SupportedFeatures
{
get
{
if(Site != null && Site.DesignMode)
{
return Features.All;
}
else
{
return base.SupportedFeatures;
}
}
set
{
if(Site == null || !Site.DesignMode)
{
base.SupportedFeatures = value;
}
}
}


Is this necessary?

Aleks Seovic
05-07-2005, 08:30 AM
That might be the way to do it, although if I remember correctly there is an attribute we can use to make designer ignore these properties.

Either way, I'll make the change to fix designer issue, thanks for reporting this.

- Aleks