4
我可以從服務器端使用靜態接收callbackresult方法從服務器端獲取對象。通過客戶端功能在服務器端調用非靜態方法
但我想在我的頁面中運行非靜態方法,通過調用客戶端函數來填充ajax手風琴。
我從服務器端調用的對象是一個複雜的對象,我不能在客戶端使用,如果我通過回調結果得到它。
是否有任何其他解決方案,我可以在客戶端控件的aspx文件中運行非靜態方法?
代碼我使用至今...
function ReceiveServerData(arg, context) {
//Message.innerText = "Date from server: " + arg;
}
#region ICallbackEventHandler Members
public void RaiseCallbackEvent(String eventArgument)
{
// Processes a callback event on the server using the event
// argument from the client.
Insert(); // this is running, but doesnt work !
//printAlternativesFromAirport(eventArgument);
}
public string GetCallbackResult()
{
// Returns the results of a callback event to the client.
return null;
}
#endregion
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);
}