Widget added inside span
Hello,
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" />
</asp:HyperLink>
But when the widget is dropped on page, SPAN tag appear and change all my CSS.
<div class="news_archive">
<span>
<a class="box" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_lnkCallout">
<img src="" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_imgCallout"></a>
//start literal
<h3>
<a href="news_archive.html Archives</a>
</h3>
//endliteral
</span>
</div>
And this widget is dropped in
<div class="news_archive">
<asp:ContentPlaceHolder ID="v1TopHolder" runat="server">
//here
</asp:ContentPlaceHolder>
</div>
Somebody may know why is that SPAN added and how can i remove it?
Thanks!
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);
Good luck!
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.