access asp control in my user control via javascript
-
hi, I have an asp.net label () in my user control(ascx file). I want to change its bg color and visibility via javascript function when the user clicks on it. I try to do somethimg like this: function Change() { document.getElementById("<%=lbl1.ClientID%>").backgroundColor = "red"; } it doesnt work. anybogy has any idea?
-
hi, I have an asp.net label () in my user control(ascx file). I want to change its bg color and visibility via javascript function when the user clicks on it. I try to do somethimg like this: function Change() { document.getElementById("<%=lbl1.ClientID%>").backgroundColor = "red"; } it doesnt work. anybogy has any idea?
U have to use the Control UniqueID of the label you want to change color. lbl1.ClientID wont work.
-
hi, I have an asp.net label () in my user control(ascx file). I want to change its bg color and visibility via javascript function when the user clicks on it. I try to do somethimg like this: function Change() { document.getElementById("<%=lbl1.ClientID%>").backgroundColor = "red"; } it doesnt work. anybogy has any idea?
try this document.getElementById("<%=lbl1.ClientID%>").style.backgroundColor = "red";
-
U have to use the Control UniqueID of the label you want to change color. lbl1.ClientID wont work.
This link wil further explain it to you. http://forums.asp.net/t/443188.aspx[^]
-
hi, I have an asp.net label () in my user control(ascx file). I want to change its bg color and visibility via javascript function when the user clicks on it. I try to do somethimg like this: function Change() { document.getElementById("<%=lbl1.ClientID%>").backgroundColor = "red"; } it doesnt work. anybogy has any idea?