LinkButtonInternal.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: LinkButtonInternal
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: 100%
  10. *
  11. * (C) Gaurav Vaish (2002)
  12. */
  13. using System;
  14. using System.Drawing;
  15. using System.Web;
  16. using System.Web.UI;
  17. namespace System.Web.UI.WebControls
  18. {
  19. internal class LinkButtonInternal : LinkButton
  20. {
  21. public LinkButtonInternal() : base()
  22. {
  23. }
  24. protected override void Render(HtmlTextWriter writer)
  25. {
  26. SetForeColor();
  27. Render(writer);
  28. }
  29. private void SetForeColor()
  30. {
  31. if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
  32. {
  33. Control ctrl = this;
  34. Color foreCol;
  35. int ctr = 0;
  36. //FIXME: this-> LinkButton-> WebControl
  37. while(ctr < 2)
  38. {
  39. ctrl = ctrl.Parent;
  40. foreCol = ((WebControl)ctrl).ForeColor;
  41. if(foreCol != Color.Empty)
  42. {
  43. ForeColor = foreCol;
  44. return;
  45. }
  46. ctr++;
  47. }
  48. }
  49. }
  50. }
  51. }