ButtonColumn.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: ButtonColumn
  4. *
  5. * Author: Gaurav Vaish
  6. * Contact: <[email protected]>, <[email protected]>
  7. * Status: 20%
  8. *
  9. * (C) Gaurav Vaish (2001)
  10. */
  11. using System;
  12. using System.ComponentModel;
  13. using System.Web;
  14. using System.Web.UI;
  15. namespace System.Web.UI.WebControls
  16. {
  17. public class ButtonColumn : DataGridColumn
  18. {
  19. private PropertyDescriptor textFieldDescriptor;
  20. public ButtonColumn()
  21. {
  22. //TODO: Initialization
  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. }
  35. public virtual ButtonColumnType ButtonType
  36. {
  37. get
  38. {
  39. object o = ViewState["ButtonType"];
  40. if(o!=null)
  41. return (ButtonColumnType)o;
  42. return ButtonColumnType.LinkButton;
  43. }
  44. set
  45. {
  46. if(!System.Enum.IsDefined(typeof(ButtonColumnType), value))
  47. throw new ArgumentException(/*To supply the values*/"");
  48. ViewState["ButtonType"] = value;
  49. }
  50. }
  51. public virtual string CommandName
  52. {
  53. get
  54. {
  55. string cn = (string)ViewState["CommandName"];
  56. if(cn!=null)
  57. return cn;
  58. return String.Empty;
  59. }
  60. set
  61. {
  62. ViewState["CommandName"] = value;
  63. }
  64. }
  65. public virtual string DataTextField
  66. {
  67. get
  68. {
  69. string dtf = (string)ViewState["DataTextField"];
  70. if(dtf!=null)
  71. return dtf;
  72. return String.Empty;
  73. }
  74. set
  75. {
  76. ViewState["DataTextField"] = value;
  77. }
  78. }
  79. public virtual string DataTextFormatString
  80. {
  81. get
  82. {
  83. string dtfs = (string)ViewState["DataTextFormatString"];
  84. if(dtfs!=null)
  85. return dtfs;
  86. return String.Empty;
  87. }
  88. set
  89. {
  90. ViewState["DataTextFormatString"] = value;
  91. }
  92. }
  93. public virtual string Text
  94. {
  95. get
  96. {
  97. string text = (string)ViewState["Text"];
  98. if(text!=null)
  99. return text;
  100. return String.Empty;
  101. }
  102. set
  103. {
  104. ViewState["Text"] = value;
  105. }
  106. }
  107. protected virtual string FormatDataTextValue(object dataTextValue)
  108. {
  109. // TODO: The LOST WORLD! :))
  110. return String.Empty;
  111. }
  112. }
  113. }