ICallbackEventHandler synchronous bis ?

Discussion in 'ASP .Net' started by KaNos, Jul 27, 2006.

  1. KaNos

    KaNos Guest

    Sorry always the same question.

    I press a HTML button :
    <input name="butGet" type="button" value="Get()" style="width: 147px"
    id="butGet" onclick="butGet_onclick()" />

    This event call a javascipt function butGet_onclick():
    function ToInitialize()
    {
    var result = Get("");
    if ( result != "true" )
    {
    alert ("Not True");
    }
    }

    In this function, I wait the result of another Get("") :
    var _strjReturn = "";
    function Get(parameter)
    {
    strParameters = "Get" + "|" + parameter + "|";
    CallServer(strParameters,"");
    return _strjReturn;
    }

    The Callserver is created in the event page_load
    protected void Page_Load(object sender, EventArgs e)
    {
    ClientScriptManager clientscriptMain = Page.ClientScript;

    string strClientScript =
    clientscriptMain.GetCallbackEventReference(this, "args",
    "ReceiveServerData", "", false);
    string strCallBackFunction = "function CallServer(args,context){" +
    strClientScript + "}";
    Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
    "CallServer", strCallBackFunction, true);
    }

    With the client function :
    function ReceiveServerData(args, context)
    {
    _strjReturn = args;
    }

    You understand that I use an inherit of ICallbackEventHandler with :
    private _strReturn = "";
    public string GetCallbackResult()
    {
    return _strReturn;
    }

    public void RaiseCallbackEvent(string eventArgument)
    {
    string[] arrArgument = eventArgument.Split('|');
    if (arrArgument.Length != 0)
    {
    switch(arrArgument[0])
    {
    case "Get":
    _strReturn = "true"
    break;
    default:
    _strReturn = "Error"
    break;
    }
    }
    }

    But, and is my problem, function Get(parameter) always send an empty string
    and I show all the time the message "Not True". How can I capture the value
    "true" and return this in the function Get(parameter) ? In google, I found
    nothing.
    Thanks for response ...
     
    KaNos, Jul 27, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fabrice
    Replies:
    2
    Views:
    589
    Fabrice
    Sep 2, 2005
  2. Fabrice
    Replies:
    0
    Views:
    464
    Fabrice
    Jan 21, 2006
  3. Richard Gruet

    new-style class instance check (bis)

    Richard Gruet, Apr 11, 2004, in forum: Python
    Replies:
    0
    Views:
    282
    Richard Gruet
    Apr 11, 2004
  4. KaNos
    Replies:
    0
    Views:
    427
    KaNos
    Jul 27, 2006
  5. Rickert
    Replies:
    0
    Views:
    717
    Rickert
    Oct 6, 2011
Loading...

Share This Page