I have an asp:dropdownlist, and when a user selects an item, I am supposed to update an area next to with some information based on the selected value of the dropdownlist.
Since I am using user control, I apparently can not use page method. So I decided to use web-service, but I do not know how to properly invoke it. I do not have body tag in my user-control, so I can not use “” etc. So I decided to use RegisterClientScriptBlock during my page_load method of my user control, but it says service is undefined.
<div id="service" style="BEHAVIOR: url(webservice.htc)" >
//other controls go here...
</div>
Any idea about how to successfully invoke web-service through javascript?
Could you do this way?
The problem is valid. We can’t have
pagemethodonusercontrol. But there is work around which I mentioned above.The way you’re trying to do will not be compliance with other browser. If you’ve to build it to support all major browsers then watch out.
Another way of doing this, is you define a web service and call it through
XMLHTTPRequest– browser native object. An simple example of way of doing this.