SearchForKnowledge
SearchForKnowledge

Reputation: 3751

Why doesn't the value of SPAN update

ASP.net:

<span id="lblScore" class="lblScore">Your Score is: 0</span>
<asp:Label ID="lblHiddenScore" runat="server" CssClass="lblHScore" Text="" ClientIDMode="Static"></asp:Label>

The following jquery is executed after a certain event:

$(".lblScore").text("");
$(".lblScore").text("Your Score is: " + score);
$(".lblHScore").text(score);

I can see in the front-end, the value is changing but when I view the source of the HTML, it doesn't show the changes.

I am trying to use the score value from code-behind:

string yr = lblHiddenScore.Text; //it is always ""

How can I retrieve the value from the front end to use in code-behind

Upvotes: 2

Views: 166

Answers (1)

user57508
user57508

Reputation:

Labels are not posted back to the server, as they are not part of the form data, hence you cannot read the text of it at the server-side.

Upvotes: 3

Related Questions