Nathaniel Greene
1/24/2007 4:31:00 AM
That is not really what I want. Im looking for a way to set this when ever
the designer initializes and determines that there is no inner content.
The reason for this is because there are many issues, such as recently due
to Microsofts SP1 for VS2k5 update I can no longer drag and drop my custom
web controls from the toolbox), that will prevent a user from being able to
drag and drop. Also a user may wish to reset the content to default and in
both situations the Designer has to be able to set the Inner Content. I
cannot believe that something that Visual studio does all the time is not
capable of being user invoked from the designer.
"Walter Wang [MSFT]" wrote:
> Hi Nathaniel,
>
> To provide a default content in the inner tag, you need to create your own
> control designer and override the method GetPersistenceContent():
>
> public class Class1Designer : ControlDesigner
> {
> public override string GetPersistenceContent()
> {
> return "default content";
> }
> }
>
> [ParseChildren(false), PersistChildren(true),
> Designer(typeof(Class1Designer))]
> public class Class1 : WebControl
> {
> }
>
>
> Note this only works if the control is drag&dropped from toolbox to the
> designer surface. If the control is manually written or dropped to the
> source view, the default content will not be used. Also, when you dropped
> the control to the designer surface, you need to refresh (menu
> view/refresh, or right-click and select refresh) to see the default
> content, but the source view actually already has the default content.
>
> Let me know if you have any questions.
>
>
> Regards,
> Walter Wang (wawang@online.microsoft.com, 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.
>
>
>