Advertisement
Advertisement

I have a LinkButton with image and label inside it or tags i and span as in the following picture.example_linkbutton

The code in the page is:

<asp:LinkButton ID="LinkButton1" runat="server">
    <i class="glyphicon glyphicon-plus"></i>
    <span class="js-add-button" runat="server" id="Span1">Add New</span>
</asp:LinkButton>

After a postback everything inside the LinkButton disappeared. I’ve spent two days to understand why and the solution is very easy.

Advertisement
<asp:LinkButton ID="LinkButton1" runat="server">
    <i class="glyphicon glyphicon-plus" runat="server"></i>
    <span class="js-add-button" runat="server" id="Span1">Add New</span>
</asp:LinkButton>

The tag i doesn’t have runat="server" and for that you lost all content inside the LinkButton.

Happy coding!

Advertisement

By Enrico

My greatest passion is technology. I am interested in multiple fields and I have a lot of experience in software design and development. I started professional development when I was 6 years. Today I am a strong full-stack .NET developer (C#, Xamarin, Azure)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.