Showing posts with label necessary. Show all posts
Showing posts with label necessary. Show all posts

Saturday, March 24, 2012

Invoking a Web Service through JavaScript

Hi,

I keep getting the 'WebService is undefined' error when I try to

access my Web Service through JavaScript. I have made all necessary changes -added handlers to

the web.config file, included the DLL in the bin directory, included referernce through the

<ScriptManager> tag...

<atlas:ScriptManager ID="ScriptManager" runat="server" enablepartialrendering="true">
<Services>
<atlas:ServiceReference Path="/TestAJAXApp/MyWebService.asmx" />
</Services>
</atlas:ScriptManager>

<script type ="text/javascript">
function MyCustomFunction(MyRecordID, event)
{
var result = MyWebService.GetRecordDescription(MyRecordID, GetCallBack);
}
function GetCallBack(result)
{
Popup('Description' , result.value, false);
}
</script>

What could I be missing? Any suggestions appreciated.

Thanks!

The first thing to double check, is whether the request for the webservice proxy succeeded or not, use fiddler or whatever your favorite http traffic monitoring tool is, and verify that there indeed is a request to an url like /TestAJAXApp/MyWebService.asmx/js and that the response of that is the client javascript proxy for your webservice. My guess is that is failing in some way, and hopefully that will lead you to the problem...

Hope that helps,
-Hao

Wednesday, March 21, 2012

Is it necessary to run the Asp.Net Ajax Installation Wizard

I have an issue where my web project works well locally with AJAX, Update Panels and Partial Rendering. Everything is kosher.

As soon as I copy my project to a staging server, any page that uses Validators that become enabled through Partial Rendering seem to have issues. The validators cause script errors on some pages, while on others, they are not visible.

The only difference between my local environment (that I can think of) that may affect this is that I ran the AJAX installation on my local workstation while on the Test Server I just copied the Ajax DLLs into the bin folder.

So does anyone know this may be my problem? Is it necessary to run the full install of ASP.Net AJAX for everything to work well? If not then I may need to resort to custom Javascript for client validation which I'd rather avoid since I can't run the install on the server.

no, but you will need to include the AJAX DLLs in your BIN folder then.


Thanks for your reply! It's good that all I need are the dll's since that's all I have access to do. But that now raises the question of why is it all good locally and not remotely on my test server.

Oh well.. I guess I have 2 options:
(1) Javascript for validation
(2) No partial-rendering.. postbacks and use FakeAjax transitions to make nice ajax-like UI.


alcsharp:

Thanks for your reply! It's good that all I need are the dll's since that's all I have access to do. But that now raises the question of why is it all good locally and not remotely on my test server.

Locally the Ajax DLLs are in the GAC, since you used the Installation Wizard. On the server they aren't there, so you need to explicitly include them.


Oh, and I'm betting you are missing a DLL...
What did you include?


I only included System.Web.Extensions.dll. Since I'm not using the Control Toolkit at all I didn't add it.