Attribute not being added

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I am creating a control and I have the following:

Protected Overloads Overrides Sub AddAttributesToRender(ByVal
writer As HtmlTextWriter)
With writer
.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
.AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)
.AddAttribute(HtmlTextWriterAttribute.Bgcolor,
Me.BackColor.Name)
End With
MyBase.AddAttributesToRender(writer)
End Sub

The id and class attributes are being added but the bgcolor is not!
What am I doing wrong?

Thanks,

Miguel
 
ASP.net doesn't render bgcolor for xHTML compliance. Try using CSS.

-Mike Placentra II
 
shapper said:
Hello,

I am creating a control and I have the following:

Protected Overloads Overrides Sub AddAttributesToRender(ByVal
writer As HtmlTextWriter)
With writer
.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
.AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)
.AddAttribute(HtmlTextWriterAttribute.Bgcolor,
Me.BackColor.Name)
End With
MyBase.AddAttributesToRender(writer)
End Sub

The id and class attributes are being added but the bgcolor is not!
What am I doing wrong?

Thanks,

Miguel
try backColor or backgroundColor. This should work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top