I have created a SharePoint 2010 visual web part. In the page load event of the user control, i am setting the value of an asp.net label.
<asp:Label ID ="lbMessageIndex" runat="server" Visible="false"></asp:Label>
protected void Page_Load(object sender, EventArgs e)
{
lbMessageIndex.Text = "0";
}
I also have a anchor tag with a click event getLabelValues()
. In this method, when access the label value using jQuery, empty string value is returned.
function getLabelValues() {
var index = $('#<%=lbMessageIndex.ClientID%>').text();
alert(index);
}
Note - .html()
and .val()
returns undefined
.