2
0

LinkButtonInternal.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. public override void Render(HtmlTextWriter writer)
  25. {
  26. SetForeColor();
  27. Render(writer);
  28. }
  29. private void SetForeColor()
  30. {
  31. if(!ControlStyle.IsSet(Style.FORECOLOR))
  32. {
  33. Control ctrl = this;
  34. Color foreCol;
  35. int ctr = 0;
  36. //FIXME: Should it be 3 or 2? this-> LinkButton-> WebControl-> Control
  37. // But control does not have any ForeColor. Need to test.
  38. while(ctr < 3)
  39. {
  40. ctrl = ctrl.Parent;
  41. foreCol = ctrl.ForeColor;
  42. if(foreCol != Color.Empty)
  43. {
  44. ForeColor = foreCol;
  45. return;
  46. }
  47. ctr++;
  48. }
  49. }
  50. }
  51. }
  52. }