views:

107

answers:

1

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?

+1  A: 

Could you do this way?

The problem is valid. We can't have pagemethod on usercontrol. 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.

Ramiz Uddin
I am using master pages though, and the master page is using those ascx controls. Is this approach still workable?
progtick
yes, it is still valid.
Ramiz Uddin