Widget added inside span

Posted by Community Admin on 04-Aug-2018 14:36

Widget added inside span

All Replies

Posted by Community Admin on 07-Nov-2013 00:00

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.

<div class="news_archive">
       <a class="box" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_lnkCallout">
             <img src="" id="ContentPlaceHolder1_v1TopHolder_ctl00_ctl00_ctl00_imgCallout"></a>
            //start literal
                         <a href="news_archive.html Archives</a>

And this widget is dropped in 

<div class="news_archive">
                <asp:ContentPlaceHolder ID="v1TopHolder" runat="server">

Somebody may know why is that SPAN added and how can i remove it?


Posted by Community Admin on 07-Nov-2013 00:00

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!

Posted by Community Admin on 07-Nov-2013 00:00

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.

This thread is closed