Markupconverter WPF to ASP.NET

Sauchesaupets

New Member
I'm using MarkupConverters in WPF to parse from enum values to human readable strings.Is there a way for ASP.NET and the ASP.NET GridView or DevExpress ASPxGridView to do the same as in WPF?Something like that (from WPF) in ASP.NET:\[code\]using System;using System.Globalization;using System.Windows.Data;using System.Windows.Markup;namespace Converters{ public class PriorityToStringConverter : MarkupExtension, IValueConverter { public PriorityToStringConverter() { } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is byte) { switch ((byte)value) { case 0: return "Very high"; case 1: return "High"; case 2: return "Normal"; case 3: return "Low"; case 4: return "Very low"; default: return value; } } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } public override object ProvideValue(IServiceProvider serviceProvider) { return this; } }}\[/code\]
 
Back
Top