Strange PageMethods Behavior

kcwallace

Centurion
Joined
May 27, 2004
Messages
175
Location
Austin, TX
Can anyone tell me why the following code returns the such strange results? I cannot figure it out. :confused:

CODE BEHIND
Code:
        [System.Web.Services.WebMethod()]
        public static String getCity2()
        {
            return "No Parameter";
        }

        [System.Web.Services.WebMethod()]
        public static String getCity1(string strVal)
        {
            return strVal;
        }

CLIENT SIDE
Code:
<script type="text/javascript" language="JavaScript">
$addHandler($get("txtMailingZip"),"keyup",CallParametersPageMethod);
function CallParametersPageMethod()
{
    var strVal=document.getElementById("txtMailingZip");    
    PageMethods.getCity1('92614',onSucceeded,onFailed);   
}

function onSucceeded(result,userContext,methodName)
{
    var strVal=document.getElementById("Label1");
    strVal.innerHTML="inSucceed";
    document.form1.txtState.value=result;
}

function onFailed(error,userContext,methodName)
{
}
</script>

txtState displays:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title> Untitled Page</title></head><body> <form name="form1" m
 
I solved the problem, but I do not know why it is solved.

I wrote the code in another project on another PC, and it worked perfectly.

I then transferred the working page to the original application on the original PC, and it returned the same results.

I then created a new application on the original PC, and copied the wirking page into the new application, and it worked perfectly.

Does anyone know what setting might be incorrect in the original application to prevent it from working properly?
 
Back
Top