Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
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
 
Old April 10th, 2008, 12:33 PM
Registered User
 
Join Date: Apr 2008
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
 
Old April 10th, 2008, 11:49 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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:

http://msdn2.microsoft.com/en-us/lib...m.getname.aspx

-Peter
peterlanoie.blog
 
Old April 11th, 2008, 09:46 AM
Registered User
 
Join Date: Apr 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





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





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