I've below code in page load of certain page: Also inherited ICallbackEventHandler
string objRef = Page.ClientScript.GetCallbackEventReference(this, "arg", "displayThankYou", string.Empty, true);
string strCallbackScript = "function CallServer(arg, context){" + objRef + ";}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallBack", strCallbackScript, true);
Then I've below function:
public void RaiseCallbackEvent(string eventArg)
{
//Do something
}
From the aspx page, onclick of a button I've called some javascript function:
function abc()
{
var data = selectedChannel.value;
// Call server side code
CallServer(data, "");
}
Still onclick, RaiseCallbackEvent is not firing.
It is just refreshing whole page which is not desirable as I don't want the whole page to have postback.