Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.ComponentModel - ignore property

Tags:

c#

.net

asp.net

I'm creating custom UserControl in ASP.NET and I'm using System.ComponentModel.Attributes to decorate properties with different things. By default, ASP.NET shows all public GET; SET properties of a control in properties window on ASPX page. What attribute I can use to ignore some of the properties ?

I tried to find something related to "ignore" on http://msdn.microsoft.com/en-us/library/system.componentmodel.aspx page, but didn't find anything.

Thanks

like image 706
Alex Dn Avatar asked Mar 04 '26 18:03

Alex Dn


2 Answers

You need BrowsableAttribute

Specifies whether a property or event should be displayed in a Properties window.

[Browsable(false)]
public int MyProperty { get; set; }
like image 85
archil Avatar answered Mar 06 '26 07:03

archil


You should be able to hide the property with [Browsable] attribute.

Specifies whether a property or event should be displayed in a Properties window.

like image 45
Miroslav Popovic Avatar answered Mar 06 '26 08:03

Miroslav Popovic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!