Widget added inside span
I have a widget like this:
<%@ Control Language="C#" %>
<asp:HyperLink runat="server" ID="lnk" class="box">
<asp:Image ID="img" runat="server"></asp:Image>
<asp:Literal ID="lt" runat="server" />
But when the widget is dropped on page, SPAN tag appear and change all my CSS.
<a class="box" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_lnkCallout">
<img src="" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_imgCallout"></a>
<a href="news_archive.html Archives</a>
And this widget is dropped in
<asp:ContentPlaceHolder ID="v1TopHolder" runat="server">
Somebody may know why is that SPAN added and how can i remove it?
I found the solution and i will post here, maybe somebody else will need.
The key is to averride a function inside widget .cs file, be carefull, not in designer.
protected override void Render(HtmlTextWriter writer) RenderContents(writer);
I think that's actually an ASP.NET issue, rather than a Sitefinity issue, and that 'fix' is typical for ASP.NET controls.
Personally, I avoid using the simple ASP.NET controls where ever possible, and just add runat="server" and clientmode="predictable" to standard html elements, when I need code-behind access.
Of course, there are still times when you need those simple ASP.NET controls, but most times you don't.