Saturday, March 24, 2012

CascadingDropDown Work only locally

HI,

I basically followed the sample toolkitCascadingdropdown. i only need 2 dropdown lists - Country and State.

everything works find on both local and live server. but when I'm calling the webservice from another website it has problems - a javascript error

<asp:DropDownList ID="ddlCountry" runat="server" />
<asp:DropDownList ID="ddlState" runat="server" />

<ajaxtoolkit:cascadingdropdown id="CascadingDropDown1" runat="server" category="State" loadingtext="Please wait..." parentcontrolid="ddlCountry" prompttext="Select a country"
servicemethod="GetStatByCountryID" servicepath="http://www.domainname.com/WebService/AddressService.asmx" targetcontrolid="ddlState">
</ajaxtoolkit:cascadingdropdown>

all sample I've seen is for working locally - both dropdownlists and webservice are sitting in the same website.

wondering if anyone can show me show to implement this cascadingdropdown by calling an external webservice

much appreciated

Hi,

So your intention is to call a external web service?

XmlHttpRequest object can't access external web service directly for security reasons. So, you may achieve this by adding a web service in the same domain, and this web service calls the external service. On client side, use this new web service to access the external web service indirectly.

Hope this helps.


This is exactly what I did, works out perfectly.

I created a local webserivce calling the external one.

much appreciated for your reply.

No comments:

Post a Comment