Suppress border="0" on ASP.NET Image Controls
-
I have used the ASP.NET Image Control to display several images. Now, the created img-Tags in the resulting HTML all have a border="0" attribute. However, I absolutely do not want this attribute to be there; I use XHTML 1.1 for the whole page (and I was glad that the Image Control rendered as XHTML - ) and CSS Style Sheets to control the visual appearance. My (external) Stylesheet contains definitions for border etc. so there's no need for border="0" on the img tag. Does anyone know how I could suppress this attribute? I have already tried setting BorderStyle to NotSet and calling Attributes.Remove("border"), but none of this helps.
-
I have used the ASP.NET Image Control to display several images. Now, the created img-Tags in the resulting HTML all have a border="0" attribute. However, I absolutely do not want this attribute to be there; I use XHTML 1.1 for the whole page (and I was glad that the Image Control rendered as XHTML - ) and CSS Style Sheets to control the visual appearance. My (external) Stylesheet contains definitions for border etc. so there's no need for border="0" on the img tag. Does anyone know how I could suppress this attribute? I have already tried setting BorderStyle to NotSet and calling Attributes.Remove("border"), but none of this helps.
It might be a bit extreme, but you could create a control derived from the Image Control and override the Render method. In order to maintain the existing functionality it would probably best to call the base Render method with a dummy writer and then extract what was written and remove the offending attribute and finally write it out on the real writer. Does this help? Or does it just sound like using a sledge-hammer to crack an egg?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar The Second EuroCPian Event will be in Brussels on the 4th of September
-
It might be a bit extreme, but you could create a control derived from the Image Control and override the Render method. In order to maintain the existing functionality it would probably best to call the base Render method with a dummy writer and then extract what was written and remove the offending attribute and finally write it out on the real writer. Does this help? Or does it just sound like using a sledge-hammer to crack an egg?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar The Second EuroCPian Event will be in Brussels on the 4th of September
I had already considered writing my own Image control, but I had not yet thought of deriving it from the original Image control. After all, it did sound like using a sledge-hammer to crack an egg, so I hoped there might be some trick to achieve this. I guess I'll use the sledgehammer then and write my own image control for this application.
-
I had already considered writing my own Image control, but I had not yet thought of deriving it from the original Image control. After all, it did sound like using a sledge-hammer to crack an egg, so I hoped there might be some trick to achieve this. I guess I'll use the sledgehammer then and write my own image control for this application.
If it is not absolutely necessary to have asp image control, then you can always use html image control and run it as server control. //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke