getting script error: unhandled exception occured during the web request

Posted by Abhi_patil under JavaScript on 6/9/2009 | Views : 2650 | Status : [Member] | Replies : 3
i am getting script error: unhandled exception occured during the web request.
PageMethod is calling well, but when i post back to same page then it generates script error.
server method 'SaveData' failed with following error.
unknown web method SaveData..

unhandled exception occured during the web request

following is details of my code regarding PageMethod..

default.aspx


<ajaxToolkit:ToolkitScriptManager runat="server" AsyncPostBackTimeout="240" ID="ScriptManager1" EnablePageMethods="true" >
<Services>
<asp:ServiceReference
path="~/Users/WebService.asmx" />

</Services>
</ajaxToolkit:ToolkitScriptManager>

<script type="text/javascript" language="javascript">
window.setInterval(AutoSave,10000);
function AutoSave()
{
//alert('called');
var msg=document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
var num=document.getElementById('ctl00_ContentPlaceHolder1_txtNumber').value;
PageMethods.SaveData(msg,num,OnSucceeded);
}
function OnSucceeded(result, userContext, methodName)
{
//alert(result);
}
</script>

code behind..default.aspx.cs
[WebMethod]
[ScriptMethod]
public static string SaveData(string msg, string num)
{
string str = "hiiiii";
try
{
Quick_SMS save = new Quick_SMS();

save.updateDB(msg, num);
}
catch (Exception ex) { }
return str;
}




Responses

Posted by: Vuyiswamb on: 6/10/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning

Can i see the Declaration of SaveData method. This means that the Method you are Calling does not exists , or maybe you did not mark it as a web method

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi_patil on: 6/10/2009 [Member] Starter

Up
0
Down
i resolved that error it was because of page transfer..
but now the problem is i am not getting textbox and hidden field value in page mathod..


how to get textbox value in page method...please help..


Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Anup1252000 on: 8/2/2009 [Member] Starter

Up
0
Down
i m not able to get ur question.. can u elaborate clearly..

https://wordpress.com/pages/anuphosur.wordpress.com

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response