A
Angel
I am trying to set HTML elements in my server control to the ForeColor setting for the control. For example I create a server control which I inherit from WebControls. WebControls exposes the ForeColor property of the control. Now in my code I render certain tags in which I want to set its Style attribute "color" to what the developer selected in the ForeColor of the control.
writer.writeBeginTag("DIV")
writer.writeAttribute("ID", "TEST")
writer.writeAttribute("STYLE", "COLOR: " & Me.ForeColor.ToString & ";")
The Me.ForeColor is the Control ForeColor setting. Unfotunately when I test this piece of code and I view the source it does writes the TAG this way when I view the source for the HTML.
<DIV ID="TEST" STYLE="COLOR: color white">
HTML does not recognize this coding so it does not set the color. I tried setting this setting in my code:
writer.writeBeginTag("DIV")
writer.writeAttribute("ID", "TEST")
writer.writeAttribute("STYLE", "COLOR: " & Me.ForeColor.ToArgb & ";")
And it wrote this in the HTML Source:
<DIV ID="TEST" STYLE="COLOR: -1">
HTML Did not recognize this either. So How can I convert the color in the property of the control to something that will be written correctly when the HTML is built? Is there a Hex function that can call on the ForeColor property to return the Hex value and then write it to the HTMLWriter stream?
thanks...
writer.writeBeginTag("DIV")
writer.writeAttribute("ID", "TEST")
writer.writeAttribute("STYLE", "COLOR: " & Me.ForeColor.ToString & ";")
The Me.ForeColor is the Control ForeColor setting. Unfotunately when I test this piece of code and I view the source it does writes the TAG this way when I view the source for the HTML.
<DIV ID="TEST" STYLE="COLOR: color white">
HTML does not recognize this coding so it does not set the color. I tried setting this setting in my code:
writer.writeBeginTag("DIV")
writer.writeAttribute("ID", "TEST")
writer.writeAttribute("STYLE", "COLOR: " & Me.ForeColor.ToArgb & ";")
And it wrote this in the HTML Source:
<DIV ID="TEST" STYLE="COLOR: -1">
HTML Did not recognize this either. So How can I convert the color in the property of the control to something that will be written correctly when the HTML is built? Is there a Hex function that can call on the ForeColor property to return the Hex value and then write it to the HTMLWriter stream?
thanks...