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.G etType(),
"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 ...