Is it possible to add a new instance in during an asynchronous postback so that I can subsequently use the referenced web service through the client side of the script? ServiceReferenceScriptManagerPage
I'm trying to do this inside UserControl, which is inside Repeater, so using the ScriptReference software programmatically while Page_Loadnot working here.
EDIT 2: This is the code I call from mine UserControlthat does not do what I expect (adding ServiceReference to the ScriptManager during async postback):
private void RegisterWebservice(Type webserviceType)
{
var scm = ScriptManager.GetCurrent(Page);
if (scm == null)
throw new InvalidOperationException("ScriptManager needed on the Page!");
scm.Services.Add(new ServiceReference("~/" + webserviceType.Name + ".asmx"));
}
My goal is to make my my UserControl as unobtrusive to the surrounding application as possible; otherwise, I would have to statically define in in containing what I don't want. ServiceReferenceScriptManagerProxyPage
EDIT:
I must have been tired when I wrote this message ... because I wanted to write no . Updated text above. ServiceReferenceScriptReference
Now I have:
<asp:ScriptManagerProxy runat="server" ID="scmProxy">
<Services>
<asp:ServiceReference Path="~/UsefulnessWebService.asmx" />
</Services>
</asp:ScriptManagerProxy>
but I want to register webservice in CodeBehind.
source
share