views:

58

answers:

0

Hi All,

I have a one more question on ASP.NET UserControl. Assume I have a user control MyUserControl that exposes BufferCapacity property. The control internally maintains an array of size BufferCapacity. Now at design time I have shadowed this property. But if I change the proeprty, the value is not getting serialized in the *.aspx code.

The shadowing code in the designer of MyUserControl goes something like this,

    public int BufferCapacity
    {
        get
        {
            return (int)ShadowProperties[PropertyNameBufferCapacity];
        }
        set
        {
            ShadowProperties[PropertyNameBufferCapacity] = value;
        }
    }

protected override void PostFilterProperties(IDictionary properties)
    {
        PropertyDescriptor bufferCapacityPropertyDescriptor = properties[PropertyNameBufferCapacity] as PropertyDescriptor;
        if (bufferCapacityPropertyDescriptor != null)
        {
            properties[PropertyNameBufferCapacity] = TypeDescriptor.CreateProperty(typeof(PlotDesigner), bufferCapacityPropertyDescriptor, new Attribute[] { new DefaultValueAttribute(DefaultBufferCapacity) });
        }

        base.PostFilterProperties(properties);
    }

Am I doing something wrong? Why the property BufferCapacity="some value" is not getting serialized? Please someone help me with this...

-Thanks a lot,

Dattebayo