Hey all i am trying to get the value from the label here in my code:
<div id="chkHaz" data-checked="no">
<asp:Label ID="lblchkHaz" runat="server" Text="no" ClientIDMode="Static" Style="visibility: hidden; display: none;"></asp:Label>
<asp:Image ID="check_chkHaz" runat="server" ImageUrl="~/images/chkOFF.png" ClientIDMode="Static" />
</div>
I set it depending on if the user has “checked” it or not via JQuery:
$("#chkHaz").click(function (input) {
if ($(this).attr("data-checked") == "no") {
$('#check_' + $(this).attr('id')).attr("src", "/images/chkON.png");
$(this).attr("data-checked", "yes");
$('#lbl' + $(this).attr('id')).attr("text", "yes");
$('#lbl' + $(this).attr('id')).html("yes");
} else {
$('#check_' + $(this).attr('id')).attr("src", "/images/chkOFF.png");
$(this).attr("data-checked", "no");
$('#lbl' + $(this).attr('id')).attr("text", "no");
$('#lbl' + $(this).attr('id')).html("no");
}
});
However, when i go to check it via code behind:
Dim strChkHaz As String = lblchkHaz.text & ""
It always is “no” even though i KNOW that it changes the HTML value of “no” to “yes” and the “text” from “no” to “yes”

changes to…

1) In the .aspx file add
2) In JS find that hidden field and update it at the same time when you are changing the label.
3) Now in the code-behin read the .Value property from the hidden field instead of looking at the label text.