|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Image Server Control's Style/BorderHas anyone else noticed that the Image server control emits a style attribute for a 0px border by default? If I drop an Image control on a form and set nothing but the ImageUrl property, it is rendered as the following: <img id="Image1" src="Blue%20hills.jpg" style="border-width:0px;" /> This is just not good when I want to specify a CSS class for the image that uses a border. Again, if I add a value to the CssClass property to my image that specifies a border, it is still rendered as follows: <img id="Image1" class="Bordered" src="Blue%20hills.jpg" style="border-width:0px;" /> This overwrites my style and removes the border! Am I losing my mind here? Thanks, Matt Never noticed it until you said something. So I looked into the
Image.AddAttributesToRender method and noticed: If Me.BorderWidth.IsEmpty Then If MyBase.EnableLegacyRendering Then writer.AddAttribute(HtmlTextWriterAttribute.Border, "0", False) Else writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px") End If End If So you're right, the border width attribute will always be rendered even if it is empty. You can get around that problem by creating a custom image class, override AddAttributesToRender() and remove that code block. or you can use the html image control directly.
row count in inherited GridView control
Use windows control in asp.net 2.0 Re: How to get underlying data of TreeView control? (ASP.NET 2.0) Dynamically created (and selected) radiobuttons fire CheckedChanged event on Postback Treeview control determining if node expanded or selected Design Time Error: Error Rendering Control ValidateEvent bug with table and radio button Panel with Header want to create custom control using graphics Bounded Datagrid and Subtotal rows |
|||||||||||||||||||||||