By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

Link Button css

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

Expand|Select|Wrap|Line Numbers
  1.  function ActiveLink() {
  2.         var InpHide1 = document.getElementById('<%= InpHide.ClientID %>');
  3.         var InpHideLB = document.getElementById('<%= InpHideLB.ClientID %>');
  4.         if (InpHide1.value != "0") {
  5.             //link button text color css is pending
  6.             var TDId = document.getElementById(InpHide1.value);
  7.             TDId.className = "Header1";
  8.             alert(InpHideLB.value);
  9.             var LinkButton = document.getElementById(InpHideLB.value);
  10.             LinkButton.className = "lnkVisited";
  11.         }
  12.     }
  13.  
  14.     function lnkClicked(lnkButtonTD, linkButton) {
  15.         document.getElementById('<%= InpHide.ClientID %>').value = lnkButtonTD;
  16.         document.getElementById('<%= InpHideLB.ClientID %>').value = linkButton;
  17.     }
  18.  
  19. and 
  20.  <asp:LinkButton ID="LBTicket" runat="server" Width="100%" CssClass="lnkButton" 
  21.                                             onclick="LBTicket_Click"   OnClientClick="lnkClicked('LBTicket1','LBTicket')" CausesValidation="False"> Ticket</asp:LinkButton>
  22.  
in which linkbutton id is passed as string.
but document.getElementById(InpHideLB.value);
var LinkButton = document.getElementById(InpHideLB.value);
LinkButton.className = "lnkVisited"
is not working...
Sep 12 '13 #1
Share this Question
Share on Google+
1 Reply


P: 1
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:
http://msdn.microsoft.com/en-us/libr....cssclass.aspx

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!
Sep 30 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.