how to add class attribute to html code?

N

Neo

Hi,

I have a control that has a property. The property is a class type. I have
made it expandable in property grid like fontinfo class.
But I set a property of that class, the property is not written to the
control as an inline attribute.

For example: if you set size property of font in lable control, there is an
Font-Size="10pt" in <asp:lable .../>.

How can I do this?
Thanks!!!


Neo
 
S

S.Sigal

Hi Neo:
I think you might be missing the all crucial "NotifyParent()" attribute on your
sub-property. Exact same thing drove me nuts too until I found out about it...

Good luck,
Sky
 
S

S.Sigal

You might also have to add:
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)

to where you are implementing the Class:

ie
[
System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty),

DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
]
MySubClass X {get {return _MySubClass;}}


It's either those two (together!), or
[
System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.Attribute
]

by itself -- it depends on how you like your attributes saved...
 
N

Neo

Hi,

Thanks, S.Sigal.It works.

Neo

S.Sigal said:
You might also have to add:
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)

to where you are implementing the Class:

ie
[
System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty),

DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
]
MySubClass X {get {return _MySubClass;}}


It's either those two (together!), or
[
System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.Attribute
]

by itself -- it depends on how you like your attributes saved...




Hi,

I have a control that has a property. The property is a class type. I have
made it expandable in property grid like fontinfo class.
But I set a property of that class, the property is not written to the
control as an inline attribute.

For example: if you set size property of font in lable control, there is an
Font-Size="10pt" in <asp:lable .../>.

How can I do this?
Thanks!!!


Neo
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top