jqueryasp.netasplinkbutton

Hide link button text and show image instead


if you dont understand what i said please do let me know via comments donot flag or downvotes

I am having linkbutton , that is used top getting Id in GridView.

I want to show Image instead of text.. I am attaching Image . See on the left side top marked section I want to get rid of text 7241

Below is my code.. but I m in need of getting 7241 on the jquery click,,, see at bottom the jquery code

ASP.Net Code

 <asp:LinkButton ID="lnkSubmission" CssClass="PopupShow" runat="server"
                                                                        data-toggle="modal" ToolTip="Make Submission"  data-target="#Submission"><%# Eval("fk_LoginId") %>
                                                                        <i class="fa fa-location-arrow" aria-hidden="true"></i>
                                                                    </asp:LinkButton>

Jquery Code

 $(function () {
            $('.PopupShow').click(function () {
                var a = $(this).text();
                $("#<%=CID.ClientID%>").val(a);
            });
        });

Current Image is

enter image description here


Solution

  • I checked and below code is working:

    <asp:LinkButton ID="btnRandom"  runat="server"  CssClass="btn btn-primary PopupShow" >
              <span aria-hidden="true" class="glyphicon glyphicon-refresh"> <label id="lbl" style="display:none;"><%#Eval("fk_LoginId")%></label> </span>
    </asp:LinkButton>
    

    JavaScript

    $('.PopupShow').click(function () {                    
              var a = $(this).find('label').html();
              console.log(a);
              alert(a);
              return false;
    });
    

    Hope this helps!