Creating your own custom classes for business objects and object datasources is a great way to provide and object model for databases.

But some classes might contain properties that you don’t expect to show to end users when they are bound to a DataGrid, FormView or other databound control.

Luckily there is an attribute that you can attach to properties that you want automatically hidden from databound controls:

[Browsable(false)]

To hide a property from databinding simply place the Browsable(false) attribute immediately before your property declaration

Example:


[Browsable(false)]
 public int MyProperty {
    get {
       // Insert code here. 
       return 0;
    }
    set {
       // Insert code here.
    }
 }

No tags for this post.