Wednesday, March 28, 2012

Ajax based custom control with web service

I want to create a simple reusable search pane control.

The idea is to have a textbox and a button. When you press the button you trigger an AJAX call to the server with the textbox value as parameter. The AJAX call then bridge the request to a web service that perform the database search an return a dataset. The dataset is then binded to a repeater in a updatepanel to display result. I've been using a WCF service for the web service.

This work fine if I host the textbox, the button and the result detail ascx file in a ASP.NET Ajax Enabled WebSite.

I try to move this part to a user web control, including the ascx files in resources. I hit the following problem: When I include the control (compiled assembly) in a ASP.Net Ajax Enabled Web site, the control display correctly but the AJAX call fail.

I think that the ScriptManagerProxy setting the AJAX service in my user control fails to find the path of the asmx ServerScript definition within the assembly.

Do you have any idea to make this work smoothly, ideally with only the assembly included in the website project?

Thanks in advance for your help

mavrj

Web user control is not only an assembly, which should include .ascx file and.ascx.cs or.ascx.vb file.There is only one asp:ScriptManager in a Ajax web form. I once tested a Ajax enabled web user control and placed it in a common web form.I found it worked fine. Can you post some codes here? We are going to test it.

No comments:

Post a Comment