我在这里尝试做的是从客户端调用一个函数,它将调用“RaiseCallbackEvent”,我试图将参数(从客户端)存储到viewstate中。然而,在回调期间从不保存viewState,为什么?
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;
}
.....
答案 0 :(得分:0)
ViewState不适用于javascript;但是,缓存是。