Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 10th, 2008, 12:33 PM
Registered User
Join Date: Apr 2008
Location: Kano, Kano, Nigeria.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting enumerated value to readable value

I have a Dataview grid that contains a column called Status.

In the database the value is enumerated.. so if a record has a Status of Closed the database value is 5 - if Status is Open database value is 1. I am getting the numbers in my page and I would like to somehow convert these dynamically so the user sees Closed, Open etc instead of 0,1,2..etc.

Is this possible. .Net Framework 3.5

-Ina Gaida Binta Single Baby
  #2 (permalink)  
Old April 10th, 2008, 11:49 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

1) Do you have a status type table in the database that contains the values and names? If so, then just join to that table and use the name column instead of the value.

2) Do these map to an enum in the code? Is so, use the Enum class static method GetName. See MSDN:


  #3 (permalink)  
Old April 11th, 2008, 09:46 AM
Registered User
Join Date: Apr 2008
Location: Kano, Kano, Nigeria.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

I added a new table that does the translation and then did a join query - all is good now. Thanks.

-Ina Gaida Binta Single Baby

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Epoch Time to Readable Date maigoro ASP.NET 3.5 Basics 2 April 12th, 2008 11:42 AM
zxml.js - is there a readable copy available? bobwazz BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 May 17th, 2007 09:21 AM
WordML to readable XML ROCXY XSLT 1 December 22nd, 2006 08:45 AM
Converting Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 November 6th, 2006 10:35 AM
Converting Dates mg1966 Classic ASP Databases 1 January 19th, 2005 09:15 AM

All times are GMT -4. The time now is 06:36 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.