I want to call a c# function from JavaScript. I tried the solution specified in Call ASP.NET function from JavaScript? but the RaisePostBackEvent
is not getting called.
My JavaScript is:
<script>
function link_load() {
var pageId = '<%= Page.ClientID %>';
__doPostBack(pageId, argumentString);
document.getElementById("sidebar1").innerHTML = "working";
}
</script>
My C# code is:
public void RaisePostBackEvent(string eventArgument)
{
sidebar1.InnerHtml = "working inside";
}
The JavaScript code is executed, which I verified.