How to store an enum inside a DataColum of a DataTable and show localized text in .Net

Posted by SoMoS on Stack Overflow See other posts from Stack Overflow or by SoMoS
Published on 2010-04-14T16:22:42Z Indexed on 2010/04/14 16:23 UTC
Read the original article Hit count: 273

Filed under:
|
|
|
|

Hello,

I have to store on one DataColum of one DataTable an Enum containing some values. De enum is defined as follow:

Imports System.ComponentModel
Imports System.Globalization

Public Enum FirmwareUpdateStatus
    <Description("updateNotExecuted")> UpdateNotExecuted = 0
    <Description("updateSuccess")> UpdateSuccess = 1
    <Description("updateError")> UpdateError = 2
End Enum

I have also a class called Enum2 that has a method called GetDescription that returns the localized text of an enum value. What I want to do is to show this text into the grid that shows the DataTable but storing the enum value, not the string.

How can this be done?

Thanks in advance"

© Stack Overflow or respective owner

Related posts about .NET

Related posts about gridview