Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > HTML in custom control lost when property changed in design view

Reply
Thread Tools

HTML in custom control lost when property changed in design view

 
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-06-2004
I've searched in vain to find the answer to this question, so hopefully
someone can help me.

I am creating a web custom control that will have other nested content. I
have set parseChildren attribute to false, so I can embed the content in my
finished output. When the control has been placed in my page, if I go to
design view and change a property, when I move back to HTML view, all content
between the opening and closing tags is removed.

for instance, if I have code like:

<mc:MyControl MyAttribute='Something'>
<ul>
<li>some text</li>
</ul>
</mc:MyControl>

if I go to design view and change "MyAttribute" to "Something Else" and
return to
HTML view I get

<mc:MyControl MyAttribute='Something Else'>
</mc:MyControl>

All the code inside the control is lost.

Is there some sort of property or setting that I need to change to make sure
that this doesn't happen?


 
Reply With Quote
 
 
 
 
aa7im
Guest
Posts: n/a
 
      12-06-2004
Try setting the PersistChildren attribute

http://msdn.microsoft.com/library/de...ClassTopic.asp

 
Reply With Quote
 
 
 
 
aa7im
Guest
Posts: n/a
 
      12-06-2004
Try setting the PersistChildren attribute

http://msdn.microsoft.com/library/de...ClassTopic.asp

 
Reply With Quote
 
aa7im
Guest
Posts: n/a
 
      12-06-2004
Try setting the PersistChildren attribute

http://msdn.microsoft.com/library/de...ClassTopic.asp

 
Reply With Quote
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-06-2004
Tried setting the persistChildrenAttribute both to true and then to false and
neither of these modifications seems to change the outcome.

"aa7im" wrote:

> Try setting the PersistChildren attribute
>
> http://msdn.microsoft.com/library/de...ClassTopic.asp
>
>

 
Reply With Quote
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-06-2004
Okay,

I think I'm getting close to an answer now. It seems as if I need to make a
controlbuilder for the inner content of the control (or something like that).
I still have to work out the details.

I also found that if I set parseChildren to true, I can also specify a
default property for content that is not a property value equivalent.

If someone knows I'm on the wrong track, I'd appreciate it if you can let me
know asap so I don't end up spinning my wheels for nothing.

"Christopher Strolia-Davis" wrote:

> Tried setting the persistChildrenAttribute both to true and then to false and
> neither of these modifications seems to change the outcome.
>

 
Reply With Quote
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-07-2004
Okay,

I've found the(an) answer to my issue, and am posting it here in case it
helps anybody.

If I create a string property in the webcontrol and set the following
meta-data for it:
<PersistenceMode(PersistenceMode.InnerDefaultPrope rty)>

it seems to hold on to the inside content.

Later,

Chris

"Christopher Strolia-Davis" wrote:

> I've searched in vain to find the answer to this question, so hopefully
> someone can help me.
>
> I am creating a web custom control that will have other nested content. I
> have set parseChildren attribute to false, so I can embed the content in my
> finished output. When the control has been placed in my page, if I go to
> design view and change a property, when I move back to HTML view, all content
> between the opening and closing tags is removed.
>

 
Reply With Quote
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-07-2004
My Bad,

Apparently I only thought this was the answer because I tested it incorrectly.

I'm still having the problem.

If anyone knows the "real" answer to the problem, please let me know.

"Christopher Strolia-Davis" wrote:

> Okay,
>
> I've found the(an) answer to my issue, and am posting it here in case it
> helps anybody.
>
> If I create a string property in the webcontrol and set the following
> meta-data for it:
> <PersistenceMode(PersistenceMode.InnerDefaultPrope rty)>
>

 
Reply With Quote
 
Christopher Strolia-Davis
Guest
Posts: n/a
 
      12-07-2004
I don't know if this is the best answer, but it worked.

I found that if I simply inherit from the system.web.ui.webcontrols.panel
control, which has much of the core functionality I was already looking for,
I was able to get past this issue. (How the panel control handles this issue,
I have no idea).

Just thought I'd let everyone know.

"Christopher Strolia-Davis" wrote:

> I've searched in vain to find the answer to this question, so hopefully
> someone can help me.
>
> I am creating a web custom control that will have other nested content. I
> have set parseChildren attribute to false, so I can embed the content in my
> finished output. When the control has been placed in my page, if I go to
> design view and change a property, when I move back to HTML view, all content
> between the opening and closing tags is removed.
>
> for instance, if I have code like:
>
> <mc:MyControl MyAttribute='Something'>
> <ul>
> <li>some text</li>
> </ul>
> </mc:MyControl>
>
> if I go to design view and change "MyAttribute" to "Something Else" and
> return to
> HTML view I get
>
> <mc:MyControl MyAttribute='Something Else'>
> </mc:MyControl>
>
> All the code inside the control is lost.
>
> Is there some sort of property or setting that I need to change to make sure
> that this doesn't happen?
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2005 html-view does not recognize the generated html-tag of a custom control Rolf Welskes ASP .Net 3 10-06-2006 06:49 PM
Add controls to my custom control with tags in HTML design view Don ASP .Net Web Controls 0 07-16-2005 02:03 AM
Add controls to my custom control with tags in HTML design view Don ASP .Net Building Controls 0 07-16-2005 02:03 AM
Web Controls switching from Design view to HTML view causing problems Ziyad Makki ASP .Net Web Controls 1 08-23-2004 07:13 PM
Wierd error when going to Design View from HTML view VB Programmer ASP .Net 1 07-10-2003 03:20 PM



Advertisments