Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Can anyone tell me why the following code returns the such strange results? I cannot figure it out. :confused:

 

CODE BEHIND

       [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

<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
Go Beavs!!!
Posted

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?

Go Beavs!!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...