返回首页

大家好,
我用VS2008创建一个回调在MSDN中描述的ASP.NET页面,后面的C#代码。
它工作正常,但只有一次。第二回调什么也没有发生,我不能重定向到另一个页面或事业回调。所有客户方的JavaScript完美的作品。
我没有得到任何错误运行页。
帮助。

代码:


using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts

 

  public partial class Letter : System.Web.UI.Page, ICallbackEventHandler

  {

 

      public void RaiseCallbackEvent(String eventArgument)

      { 

          ctrlString = eventArgument;

          SaveLetter();

 

          returnValue = LetterCreation_Click(); //LetterCreation_Click() returns a string!

      }

      public string GetCallbackResult()

      {

          return returnValue;

      }

 



    protected void Page_Load(object sender, EventArgs e)

    {

      if (!IsPostBack)

      {

          ClientScriptManager cm = Page.ClientScript;

          String cbReference = cm.GetCallbackEventReference       (this, "arg", "ReceiveServerData", "context", "ReceiveServerError", false);

          String callbackScript = "function CallServer(arg, context) {" + cbReference + "; }";

          cm.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);

      }


客户端:
{C}调用的回调:

CallServer(document.getElementById('ControlArray').value,''); //element ControlArray is a string and not an array!

回答

评论会员: 时间:2
M