Call Page method from the User control
Last Post 11/20/2014 11:04 PM by Jignesh. 2 Replies.
Author Messages
Jignesh
Nuke Newbie
Nuke Newbie
Posts:1


--
11/13/2014 2:38 AM  
Hello ,

I am using DNN version 07.03.03 (118) in my application. I have one user control & created its module. I have used that module in a page.
Now I have to call Page Method from that user control. But while calling the function I am receiving an javascript error.

User control path : DesktopModules\ProductList\ProductList.ascx
Function in user control:
[System.Web.Services.WebMethod]
public static string Hello()
{
try
{
string returnString = "Hello";
return returnString;
}
catch (Exception ex)
{
throw ex.InnerException;
}
}

Javascript function:
<script type="text/javascript"> <br /> $(document).ready(function () { <br /> Hello(); <br /> }); <br /> function Hello() { <br /> $(function () { <br /> $.ajax({ <br /> type: 'POST', <br /> url: '/ProductList.ascx/Hello', <br /> data: "{}", <br /> async: false, <br /> success: function (response) { <br /> alert("Success"); <br /> }, <br /> error: function (xhr, ajaxOptions, thrownError) { <br /> if (xhr.responseJSON.Message != null) <br /> alert(xhr.responseJSON.Message); <br /> else <br /> alert(String(thrownError)); <br /> } <br /> }); <br /> }); <br /> } <br /> </script> <br /> <br /> <br />
Joseph Craig
DNN MVP
Posts:11667


--
11/14/2014 9:44 AM  
You probably will get a better answer if you ask this on the developer forums at dnnsoftware.com.

Joe Craig, Patapsco Research Group
Complete DNN Support
Jignesh
Nuke Newbie
Nuke Newbie
Posts:1


--
11/20/2014 11:04 PM  
Thank you Joseph.

I am going to post over there.


---