DataFieldConverter.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // System.Web.UI.Design.DataFieldConverter
  3. //
  4. // Authors:
  5. // Gert Driesen ([email protected])
  6. //
  7. // (C) 2004 Novell
  8. //
  9. using System.ComponentModel;
  10. using System.Globalization;
  11. namespace System.Web.UI.Design
  12. {
  13. public class DataFieldConverter : TypeConverter
  14. {
  15. public DataFieldConverter ()
  16. {
  17. }
  18. public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
  19. {
  20. return (sourceType == typeof(string));
  21. }
  22. public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
  23. {
  24. if (value == null)
  25. return string.Empty;
  26. if (value.GetType () == typeof(string))
  27. return ((string) value);
  28. throw base.GetConvertFromException (value);
  29. }
  30. [MonoTODO]
  31. public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
  32. {
  33. throw new NotImplementedException ();
  34. }
  35. public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
  36. {
  37. return false;
  38. }
  39. public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
  40. {
  41. return ((context.Instance as IComponent) != null);
  42. }
  43. }
  44. }