DataListItem.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: DataListItem
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: 95%
  10. *
  11. * (C) Gaurav Vaish (2002)
  12. */
  13. using System;
  14. using System.Collections;
  15. using System.Web;
  16. using System.Web.UI;
  17. using System.ComponentModel;
  18. namespace System.Web.UI.WebControls
  19. {
  20. [ToolboxItem(false)]
  21. public class DataListItem : WebControl, INamingContainer
  22. {
  23. int itemIndex;
  24. ListItemType itemType;
  25. object dataItem;
  26. public DataListItem(int itemIndex, ListItemType itemType)
  27. {
  28. this.itemIndex = itemIndex;
  29. this.itemType = itemType;
  30. }
  31. public virtual object DataItem
  32. {
  33. get
  34. {
  35. return dataItem;
  36. }
  37. set
  38. {
  39. dataItem = value;
  40. }
  41. }
  42. public virtual int ItemIndex
  43. {
  44. get
  45. {
  46. return itemIndex;
  47. }
  48. }
  49. public virtual ListItemType ItemType
  50. {
  51. get
  52. {
  53. return itemType;
  54. }
  55. }
  56. [MonoTODO]
  57. public virtual void RenderItem(HtmlTextWriter writer, bool extractRows, bool tableLayout)
  58. {
  59. //TODO: Complete me!
  60. throw new NotImplementedException();
  61. }
  62. protected override Style CreateControlStyle()
  63. {
  64. return new TableItemStyle();
  65. }
  66. protected override bool OnBubbleEvent(object source, EventArgs e)
  67. {
  68. if(e is CommandEventArgs)
  69. {
  70. RaiseBubbleEvent(this, new DataListCommandEventArgs(this, source, (CommandEventArgs)e));
  71. return true;
  72. }
  73. return false;
  74. }
  75. protected internal virtual void SetItemType(ListItemType itemType)
  76. {
  77. if(Enum.IsDefined(typeof(ListItemType), itemType))
  78. {
  79. this.itemType = itemType;
  80. }
  81. }
  82. }
  83. }