You must Sign In to post a response.
  • Category: ASP.NET

    How to set both image and text for linkbutton control in ASP.NET through CSS ?

    I want linkbutton control in asp.net to have both icon and text for login, add update delete etc (.png or .gif) with it.

    I have googled and find some posts saying its possible through css with following code:

    .clslnkbutton {
    background: url(../images/icons/login.png) no-repeat left top;
    display:inline;
    padding-left:18px;
    margin-left: 10px;
    padding-right:10px;
    }

    <asp:LinkButton ID="LinkButton1" CssClass="clslnkbutton" runat="server">Login</asp:LinkButton>

    But, after trying above code still its not displaying image.
    Please tell some solution.
  • #768828
    your code is working.. if you want to display only the image, then you remove the Login string <asp:LinkButton ID="LinkButton1" CssClass="clslnkbutton" runat="server"></asp:LinkButton>

  • #768829
    Hi Tanya, I have tried as you have told but still the problem persists ?

  • #768843
    Hi Jayesh,

    If Login string is fixed thing then you can create image with the string Login that is easy for you, if any case if the string is dynamic then the easiest way is use separate controls. If you are still not yet happy and you want to continue the work whatever you tried until now then you just refer below link this might be helpful to you.

    stackoverflow.com/questions/13960958/how-to-add-an-image-to-an-asp-net-link-button-programatically

    Hope this helps you....

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments