Properties do not reliably persist using CompositeControl

W

Wayne Brantley

Hi,
Create a simple composite control using ASP2.0 CompositeControl class.
Have two webcontrols exposed as properties, so they show as subproperties in
at designtime in the properties window.

Change any of the these webcontrol properties - switch to source view -
none of the properties are persisted.

Now, switch back to design mode, change a property of them main
CompositeControl - change anything, set width to 1px and then set it back to
blank. Now, go directly and change those same webcontrol properties you
just tried. Switch to source view - all the properties persisted!

Here is a simple webcontrol that demonstrates this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Sample.WebControls
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:TestCC1 runat=server></{0}:TestCC1>")]
public class TestCC1 : CompositeControl
{

public TestCC1()
{
this.EnsureChildControls();
}

private TextBox textBox;
private Label label;


[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[NotifyParentProperty(true)]
public TextBox EditBox
{
get
{
if (this.textBox == null)
this.textBox=new TextBox();
return this.textBox;
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[NotifyParentProperty(true)]
public Label TextLabel
{
get
{
if (this.label == null)
this.label = new Label();
return this.label;
}
}


protected override void CreateChildControls()
{
this.Controls.Add(EditBox);
this.Controls.Add(TextLabel);
base.CreateChildControls();
}

}
}

Wayne Brantley
 
W

Walter Wang [MSFT]

Hi Wayne,

I was able to reproduce the issue you described. Currently I'm doing more
researching on it. I'll get back to you as soon as possible, thank you for
your patience and understanding.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi all,

We've confirmed this is an issue of current version of Visual Studio 2005.
The product team is aware of it now.

Thanks Wayne for your feedback!


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top