Make webservice available from datatype javascript
I've got a usercontrol that relies on a webservice accessible in javascript via a scriptmanager. Now I'd like to use this usercontrol as a datatype via the umbraco usercontrol wrapper.
I can't put another ScriptManager in the usercontrol since it cannot have a form tag. Is there some way of adding this webservice to a scriptmanager in Umbraco?
Make webservice available from datatype javascript
I've got a usercontrol that relies on a webservice accessible in javascript via a scriptmanager. Now I'd like to use this usercontrol as a datatype via the umbraco usercontrol wrapper.
I can't put another ScriptManager in the usercontrol since it cannot have a form tag. Is there some way of adding this webservice to a scriptmanager in Umbraco?
Regards
.Hauge
Could this be a possible solution:
if (ScriptManager.GetCurrent(Page) == null) {
ScriptManager scp = new ScriptManager();
Page.Controls.Add(scp);
}
Don't know if I misunderstood you..
Hi Jesper,
Can't you use the ScriptManager</span></span><span style="font-size: x-small;"><span style="color: #000000;">.GetCurrent Method? </span></span>
I've used this code in a usercontrol to register a Webservice that can be used from Javascript
ScriptManager</span></span><span style="font-size: x-small;"> sm = </span><span style="font-size: x-small; color: #2b91af;"><span style="font-size: x-small; color: #2b91af;">ScriptManager</span></span><span style="font-size: x-small;">.GetCurrent(Page);<font size="2">
sm.EnablePageMethods =
Sorry about the messed up code, Below a copy using notepad first.
ScriptManager sm = ScriptManager.GetCurrent(Page);
sm.EnablePageMethods = true;
ServiceReference legacyPath = new ServiceReference(GlobalSettings.Path + "/webservices/DocumentFolder.asmx");
Still a bit sleepy forgot the last part to actual register the service
ScriptManager sm = ScriptManager.GetCurrent(Page);
sm.EnablePageMethods = true;
ServiceReference legacyPath = new ServiceReference(GlobalSettings.Path + "/webservices/DocumentFolder.asmx");
if (!sm.Services.Contains(legacyPath))
sm.Services.Add(legacyPath);
Just to wrap this up: Richards suggestion was spot on, code is posted below, in a hopefully more legible writing.
Thanks a lot, Richard
.Hauge
is working on a reply...