Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
Hai
i have a problem in mover over in link button,i have 5 link buttons one by one,if we 1'st link button is click that link button font color change to blue and other change to black color.if we click 2nd link button ,2nd one change to blue color and 1st and other link button font color change to black color and so on.

By page load all link button font color is black.Below is properties change in html code.
ASP.NET
<asp:LinkButton ID="lnkAddDept" runat="server"  Font-Underline="False" CssClass ="change" OnClientClick="return AddDept_ClientClick()"font-family="Arial"
  font-size=" 12px"
  font-weight" bold"
  color=" black">Add Department </asp:LinkButton>



in change css
CSS
.change:hover
      {
          color: Red;
          text-decoration:underline;
        cursor :pointer ;
      }



and in every link button ClientClick event
JavaScript
document.getElementById("ctl00_ContentPlaceHolder1_lnkAddDept").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkAddUser").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkImpADUser").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkImpUserList").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkExpUserList").style.color = "#0064a5"



if i using above javascript for change color for link button,after that mouse over css not work,but if i remove javascript then it will work,

But my need is if click any link that one change to blue color others need to change black color and also need to work mouse over css




In simple words what i try to say,if i changed font color for link button and try to use mouser over css,it not work,but i leave default property for link button ,mouse over css work,

Regards
Aravind
Posted
Updated 23-Oct-13 21:08pm
v2

1 solution

First of all check whether your
AddDept_ClientClick()
method is working properly by using alert('test').If it's working then change your
getElementById
is as below. Firstly just test for one link (remove all other links details inside the javascript function)


document.getElementById("lnkAddDept").style.color = "black"
 
Share this answer
 
Comments
Aravindba 24-Oct-13 4:04am    
hai
thank u for ur reply,actually that java script work fine,i need mouse over function on same link button ,in that javascript i will change the font color to black,if default link button mouse over css work,but in chnage font color mouse over css not work.

In simple words what i try to say,if i changed font color for link button and try to use mouser over css,it not work,but i leave default property for link button ,mouse over css work,
Sampath Lokuge 24-Oct-13 4:13am    
Sorry,still I'm not clear what you're trying to say.Now what happen when you click the link ? The things which you expect from JS is work for you or not ?.If it's working,what else you expect from JS function ?
Aravindba 24-Oct-13 4:46am    
it work form javascript,just mouseover css not work.
just u try like this

drag and drop one link button and cssclass="chnage" below is css

.change:hover
{
color: Red;
text-decoration:underline;
cursor :pointer ;
}
and run ,it will work mouse over

and then in html code for link button properties just add font-color="black" and try,it not work css
Sampath Lokuge 24-Oct-13 4:55am    
Can you set above scenario on jsFiidle :http://jsfiddle.net/
Use hyper link instead of LinkButton.
Aravindba 24-Oct-13 5:30am    
yes ,just now i use hyper link,is not work,link button and hyper link mouse over work in default property only,if we change any fore color or any style using javascript or in html code ,mouse css not wotk.

And i try in another way,instead change font color,i just remove style form hyper link,by default hyper link have black color so it work for me

And i have another problem,Enabled= True or False and Disabled = True or False not work with linkbutton and hyper link , why ? if i use this properties buttons it will work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900