Link Button css

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anki1989
    New Member
    • Sep 2013
    • 1

    Link Button css

    Hello all,
    I have an issue in LinkButtonCss.
    I've an javascript funtion,

    Code:
     function ActiveLink() {
            var InpHide1 = document.getElementById('<%= InpHide.ClientID %>');
            var InpHideLB = document.getElementById('<%= InpHideLB.ClientID %>');
            if (InpHide1.value != "0") {
                //link button text color css is pending
                var TDId = document.getElementById(InpHide1.value);
                TDId.className = "Header1";
                alert(InpHideLB.value);
                var LinkButton = document.getElementById(InpHideLB.value);
                LinkButton.className = "lnkVisited";
            }
        }
    
        function lnkClicked(lnkButtonTD, linkButton) {
            document.getElementById('<%= InpHide.ClientID %>').value = lnkButtonTD;
            document.getElementById('<%= InpHideLB.ClientID %>').value = linkButton;
        }
    
    and 
     <asp:LinkButton ID="LBTicket" runat="server" Width="100%" CssClass="lnkButton" 
                                                onclick="LBTicket_Click"   OnClientClick="lnkClicked('LBTicket1','LBTicket')" CausesValidation="False"> Ticket</asp:LinkButton>
    in which linkbutton id is passed as string.
    but document.getEle mentById(InpHid eLB.value);
    var LinkButton = document.getEle mentById(InpHid eLB.value);
    LinkButton.clas sName = "lnkVisited "
    is not working...
    Last edited by Rabbit; Sep 12 '13, 03:46 PM. Reason: Please use code tags when posting code or formatted data.
  • jeffreyk16
    New Member
    • Sep 2013
    • 1

    #2
    Hi Anki1989,

    Did you find an answer to your question? I was thinking about this, have not setup a test page, but it seems to me you are mixing ASP.NET with HTML/DOM code. An HTML Button has a className, while in ASP.NET the LinkButton has CssClass attribute. You can see it on MSDN site:


    Also, you do not include the InpHide control in the code snippet. Is this a hidden control you use to store the value of the LinkButton and the parent container (possibly a table cell <TD>)? There are other ways to persist these values, just wondering how you intend for ActiveLink() function to get these values. Security features can sometimes get in the way of accessing controls from code.

    Cheers!

    Comment

    Working...