What I was trying to do here is to call a function from client, which will call “RaiseCallbackEvent”, and I tried to stored the argument(from client) into viewstate. Yet, the viewState is never saved during the callback , why?
public partial class _Default : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
....
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager cm = Page.ClientScript;
String cbReference = cm.GetCallbackEventReference(this, "arg",
"ReceiveServerData", "");
String callbackScript = "function CallServer(arg, context) {" +
cbReference + "; }";
cm.RegisterClientScriptBlock(this.GetType(),
"CallServer", callbackScript, true);
}
.....
public void RaiseCallbackEvent(String eventArgument)
{
ViewState["attribute"] = eventArgument;
}
.....
The ViewState isn’t available to javascript; however, the Cache is.