Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide property of ASP.NET custom control in aspx page?

I'm writing ASP.NET custom control, and I want it to have a few properties which should be visible only from code behind during run-time - I mean, these properties should not be visible both in a designer and in a aspx code of page containing this control. I've tried to use following attributes:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public List<Item> SomeData { ... }

but unfortunately this property is still visible in an Intellisense combobox when editing aspx page. Is it possible to hide this property everywhere besides server-side code ?

like image 928
user268580 Avatar asked Feb 08 '10 10:02

user268580


1 Answers

This should do the trick:

//Hide from Designer Property Grid
[Browsable(false)]
// Hide from VS.NET Code Editor IntelliSense
[EditorBrowsable(EditorBrowsableState.Never)]
// Not Serialized in Designer Source code "HTML view"
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public List<Item> SomeData { ... }
like image 66
amiir Avatar answered Nov 15 '22 00:11

amiir