ButtonColumn.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: ButtonColumn
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Status: 20%
  9. *
  10. * (C) Gaurav Vaish (2001)
  11. */
  12. using System;
  13. using System.ComponentModel;
  14. using System.Web;
  15. using System.Web.UI;
  16. namespace System.Web.UI.WebControls
  17. {
  18. public class ButtonColumn : DataGridColumn
  19. {
  20. private PropertyDescriptor textFieldDescriptor;
  21. public ButtonColumn()
  22. {
  23. Initialize();
  24. }
  25. public override void Initialize()
  26. {
  27. base.Initialize();
  28. textFieldDescriptor = null;
  29. }
  30. public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
  31. {
  32. base.InitializeCell(cell, columnIndex, itemType);
  33. //TODO: I also have to do some column specific work
  34. throw new NotImplementedException();
  35. }
  36. public virtual ButtonColumnType ButtonType
  37. {
  38. get
  39. {
  40. object o = ViewState["ButtonType"];
  41. if(o!=null)
  42. return (ButtonColumnType)o;
  43. return ButtonColumnType.LinkButton;
  44. }
  45. set
  46. {
  47. if(!System.Enum.IsDefined(typeof(ButtonColumnType), value))
  48. throw new ArgumentException();
  49. ViewState["ButtonType"] = value;
  50. }
  51. }
  52. public virtual string CommandName
  53. {
  54. get
  55. {
  56. string cn = (string)ViewState["CommandName"];
  57. if(cn!=null)
  58. return cn;
  59. return String.Empty;
  60. }
  61. set
  62. {
  63. ViewState["CommandName"] = value;
  64. }
  65. }
  66. public virtual string DataTextField
  67. {
  68. get
  69. {
  70. string dtf = (string)ViewState["DataTextField"];
  71. if(dtf!=null)
  72. return dtf;
  73. return String.Empty;
  74. }
  75. set
  76. {
  77. ViewState["DataTextField"] = value;
  78. }
  79. }
  80. public virtual string DataTextFormatString
  81. {
  82. get
  83. {
  84. string dtfs = (string)ViewState["DataTextFormatString"];
  85. if(dtfs!=null)
  86. return dtfs;
  87. return String.Empty;
  88. }
  89. set
  90. {
  91. ViewState["DataTextFormatString"] = value;
  92. }
  93. }
  94. public virtual string Text
  95. {
  96. get
  97. {
  98. string text = (string)ViewState["Text"];
  99. if(text!=null)
  100. return text;
  101. return String.Empty;
  102. }
  103. set
  104. {
  105. ViewState["Text"] = value;
  106. }
  107. }
  108. protected virtual string FormatDataTextValue(object dataTextValue)
  109. {
  110. // TODO: The LOST WORLD! :))
  111. throw new NotImplementedException();
  112. return String.Empty;
  113. }
  114. }
  115. }