The ASP.NET compiler tells me a certain tag does not accept a certain attribute, although it builds, and it renders correctly on the browser. It’s a dull warning message.
How can I disable that warning message in certain lines of the ASP.NET code?
The warning pops at this line:
<asp:ListItem Text="" Value="" style="display: none" />
Warning:
Validation (ASP.Net): Attribute 'style' is not a valid attribute of element 'ListItem'.
PS: I just want to disable that warning message for that specified line of code, I don’t want to disable it for the whole project. Is there a way to do this?
I don’t think you can suppress warnings on aspx code on individual lines because the aspx code is not really processed in a line-by-line manner (it is parsed using an XML-like parser). However, you can get around the warning by setting the style programmatically: