Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

losing inner html at design-time

0 views
Skip to first unread message

Adam Conn

unread,
May 30, 2002, 1:00:01 PM5/30/02
to
Does anyone know how to persist custom, non-string properties at
design-time?

I have written a server control with a property that is a custom
collection class. I am able to place the control on an aspx page
using the following code. At runtime the control renders perfectly
fine:


<%@ Register TagPrefix="my_control" Namespace="Test.WebControls"
Assembly="Test.WebControls" %>
<%@ Register TagPrefix="my_days" Namespace="Test.Days"
Assembly="Test.Days" %>

<my_control:TestControl id="TestControl1" runat="server">
<days>
<my_days:RegularDay hours="8" day="Tuesday">
</my_days:RegularDay>
<my_days:OvertimeDay hours="10" day="Monday" >
</my_days:OvertimeDay>
</days>
</my_control:TestControl>


I am using a custom designer to generate a design-time view of the
control. The page parser is not parsing the <days> tag from the aspx
file. When GetPersistInnerHtml (which is not overriden in my custom
designer) tries to access the days property, it gets a null reference.

This becomes a big problem when Visual Studio decides to generate the
html for the control. I end up losing the <days> tag and everything
nested inside of it.

I think that I can override GetPersistInnerHtml and generate my own
html representation of my days collection. But that is a lot of work
I don't think it is necessary.

The page parser is able to take the html I manually add to the aspx
page and create/populate my days collection at runtime. I would think
that the page parser is able to do so at design-time as well.

Thanks!

Victor Garcia Aprea

unread,
May 30, 2002, 1:25:13 PM5/30/02
to
Hi Adam,

Are you correctly applying the ParseChildren attribute to your control class
and the PersistenceMode attribute to your days property? With these two
attributes you should be fine. If you could post some code it will help in
understanding whats going on,

-Victor.

--
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.


"Adam Conn" <use...@thickcrust.com> wrote in message
news:8fe185a7.02053...@posting.google.com...

0 new messages