I am trying to set my color in a span style to a variable...anyone know why this is wrong?
<span style="font-weight:bold; color:"<%= Acc开发者_开发知识库ountWarningStyle %>"; font-size:14px;"></span>
AccountWarningStyle is my c# variable
You need to remove the extra quote marks from around the `<%= AccountWarningStyle%>". This will render as:
<span style="font-weight:bold; color:"red"; font-size:14px;">
Where it should be:
<span style="font-weight:bold; color:red; font-size:14px;">
You have quotation marks around your C# code: "<% ... %>". The first quote makes your browser think your style attribute is finished immediately after "color:"
try declaring span
<span id="MySpan" runat="server" />
and then assign color in code behind
do check http://msdn.microsoft.com/en-us/library/7512d0d0(VS.71).aspx
精彩评论