HtmlTableCellCollection.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* System.Web.UI.HtmlControls
  2. * Authors
  3. * Leen Toelen ([email protected])
  4. */
  5. using System;
  6. using System.Web;
  7. using System.Web.UI;
  8. using System.Collections;
  9. namespace System.Web.UI.HtmlControls{
  10. public sealed class HtmlTableCellCollection : ICollection {
  11. private HtmlTableRow _owner;
  12. internal HtmlTableCellCollection(HtmlTableRow owner){
  13. _owner = owner;
  14. }
  15. public void Add(HtmlTableCell cell){
  16. Insert(-1, cell);
  17. }
  18. public void Clear(){
  19. if (_owner.HasControls()) _owner.Controls.Clear();
  20. }
  21. public void CopyTo(Array array, int index){
  22. IEnumerator tablecell = this.GetEnumerator();
  23. while(tablecell.MoveNext()){
  24. index = index + 1;
  25. array.SetValue(tablecell.Current, index);
  26. }
  27. }
  28. public IEnumerator GetEnumerator(){
  29. return _owner.Controls.GetEnumerator();
  30. }
  31. public void Insert(int index, HtmlTableCell cell){
  32. _owner.Controls.AddAt(index,cell);
  33. }
  34. public void Remove(HtmlTableCell cell){
  35. _owner.Controls.Remove(cell);
  36. }
  37. public void RemoveAt(int index){
  38. _owner.Controls.RemoveAt(index);
  39. }
  40. public int Count {
  41. get{
  42. if (_owner.HasControls()) return _owner.Controls.Count;
  43. return 0;
  44. }
  45. }
  46. public bool IsReadOnly {
  47. get{
  48. return false;
  49. }
  50. }
  51. public bool IsSynchronized {
  52. get{
  53. return false;
  54. }
  55. }
  56. public HtmlTableCell this[int index] {
  57. get{
  58. return _owner.Controls[index] as HtmlTableCell;
  59. }
  60. }
  61. public object SyncRoot {
  62. get{
  63. return null;
  64. }
  65. }
  66. } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
  67. }