BoundColumn.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: BoundColumn
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: 60%
  10. *
  11. * (C) Gaurav Vaish (2001)
  12. */
  13. using System;
  14. using System.ComponentModel;
  15. using System.Web;
  16. using System.Web.UI;
  17. namespace System.Web.UI.WebControls
  18. {
  19. public class BoundColumn : DataGridColumn
  20. {
  21. public static readonly string thisExpr = "!";
  22. private string dataField;
  23. private string dataFormatString;
  24. private bool readOnly;
  25. private PropertyDescriptor desc;
  26. public BoundColumn(): base()
  27. {
  28. //TODO: The start work
  29. Initialize();
  30. }
  31. public override void Initialize()
  32. {
  33. base.Initialize();
  34. dataField = String.Empty;
  35. dataFormatString = String.Empty;
  36. readOnly = false;
  37. desc = null;
  38. }
  39. [MonoTODO]
  40. public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
  41. {
  42. //TODO: What to do?
  43. InitializeCell(cell, columnIndex, itemType);
  44. // switch(itemType)
  45. // {
  46. // case
  47. // }
  48. throw new NotImplementedException();
  49. }
  50. public virtual string DataField
  51. {
  52. get
  53. {
  54. return dataField;
  55. }
  56. set
  57. {
  58. dataField = value;
  59. }
  60. }
  61. public virtual string DataFormatString
  62. {
  63. get
  64. {
  65. return dataFormatString;
  66. }
  67. set
  68. {
  69. dataFormatString = value;
  70. }
  71. }
  72. public virtual bool ReadOnly
  73. {
  74. get
  75. {
  76. return readOnly;
  77. }
  78. set
  79. {
  80. readOnly = value;
  81. }
  82. }
  83. [MonoTODO]
  84. protected virtual string FormatDataValue(Object dataValue)
  85. {
  86. // TODO: How to extract the value from the object?
  87. // TODO: Then format the value. Here's a possible solution
  88. if(dataFormatString == null || dataFormatString.Equals(String.Empty))
  89. return dataValue.ToString();
  90. if(dataValue is DateTime)
  91. return ((DateTime)dataValue).ToString(dataFormatString);
  92. throw new NotImplementedException();
  93. // and so on for int, String, double..
  94. // something's wrong here. there must be some shorter method!
  95. //string val = dataValue.toString(dataFormatString);
  96. }
  97. }
  98. }