How to hide a property from a datasource when binding in ASP.Net design view

.NET Programming

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.
    }
 }


Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






How to hide a property from a datasource when binding in ASP.Net design view | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.


Gold Coast Aquarium Maintenance | Gold Coast Marine Fish | Gold Coast Tropical Fish
Jewel Jones - Counselling Service - Penrith, Richmond
 
     
 Copyright © 2017 Julian Kuiters
 All trademarks and copyrights on this page are owned by their respective owners.