Defining Descriptive Text for Enumeration Members

An enumeration is a special type in the .NET Framework that is comprised of a number of named constants. While you might not have created an enumeration type yourself, you have likely used enumerations many times in day-to-day programming. For example, the rows in a GridView have a RowType property that returns an enumeration of type DataControlRowType that indicates the row's type: Header, Footer, DataRow, and so on.

When working with an enumeration we may need to display a descriptive message based on the enumeration's value. For example, using ASP.NET's Membership system you can programmatically create a new user account calling the Membership class's CreateUser method. This method specifies the success or failure of the operation via the MembershipCreateStatus enumeration. This enumeration has members like Success, InvalidUserName, InvalidPassword, DuplicateUserName, and the like. When calling this method from an ASP.NET page you might want to show the user a descriptive message based on this enumeration value.

This article explores three different ways to provide descriptive text for enumeration members.

To read the entire article, Defining Descriptive Text for Enumeration Members click here.



About the Author

Scott Mitchell

Scott Mitchell is the Editor, founder, and primary contributor to 4GuysFromRolla.com. In addition to founding 4GuysFromRolla.com, Scott also created ASPFAQs.com and ASPMessageboard.com. He works as a freelance writer, trainer, and consultant and resides in California.

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Live Webinar Tuesday, August 26, 2014 1:00 PM EDT Customers are more empowered and connected than ever, and the customer's journey has grown more complex. Their expectations are growing and trust is diminishing as they may interact with multiple brands through web, mobile and social channels. Considering 70% of the buying process in a complex sale is already complete before prospects are willing to engage with a live salesperson -- it's critical to understand your customers and anticipate their needs.* …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds