I want to set Label's text in javascript function, function call and set text to Label and I see it but when I want to read Label's text from code behind the text is previous text (for example if label's text is "5" and I set it to "10" in function but in code behind text is "5")
Javascript function
function PopUpFunction(code) {
$("#<%= lblStatus.ClientID %>").text(code);
return false;
}
Set function to click event of LinkButton
lnk.Attributes.Add("onclick", "PopUpFunction(10);");
Sumit Kesarwani
01-Sep-2014You have used text as property but it is a function, Use text() not text
$("#<%= lblStatus.ClientID %>").text(code);
Put an alert to check if your page is refreshed or redirected
You can try returning false to stop postback.
lnk.Attributes.Add("onclick", "return PopUpFunction(10);");