ButtonColumn.cs 2.4 KB

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