.net 20 callback example

code behind
    #region ICallbackEventHandler 成员
    protected string CallBackValue = string.Empty;

    string  ICallbackEventHandler.GetCallbackResult()
    {
        return  ValidateQuestion(CallBackValue).ToString();
    }
    void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
    {
        this.CallBackValue = eventArgument;
    }
    #endregion

 private string  ValidateQuestion(string txtinputData)
    { 
    return "somthing error";
}


html:

function CallServer()
            {
                var txtinput=  document.all("txtinputdata").value;
                <%=ClientScript.GetCallbackEventReference(this,"txtinput","ReceiveServerData",null) %>;
            }
            function ReceiveServerData(rValue)
            {
                if(rValue.indexOf("False")!=-1)
                {
                    validatetxt= rValue.substr(6);
                    validateAnswerType=1;
                 }
            }

posted on 2008-06-17 16:19  joyous jeny  阅读(231)  评论(0编辑  收藏  举报

导航