Reputation: 3976
I am setting value of asp:label
in JavaScript but it is blank on server side on button click.
what can be the issue?
Upvotes: 0
Views: 5050
Reputation: 460128
I assume ( you should show what you've tried ) that you've used the value
attribute.
Use innerHTML
instead. A SPAN
does not have a value
attribute.
var lbl = document.getElementById("Label1");
lbl.innerHTML = "Hello World";
Upvotes: 0
Reputation: 16144
Using jQuery:
$("#<%= label1.ClientID%>").text("SetYourTextHere");
Using javascript:
document.getElementById("<%= label1.ClientID%>").innerHTML = "SetYourTextHere";
Upvotes: 2