Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 20:24
    Kristian
    0

    How to add a Service Reference to Scriptmanager

    Hi everyone,

    I have a UserControl i have developed and it calls a webservice (ASMX) which returns some data.

    It works fine when I'm trying it in my WEB project. The Masterpage on my webpage has a ServiceReference to the webservice.

    I have copied the usercontrol to umbraco and it works except of it can't find the webservice method. I don't know how to add it and where?

    Tried to add a new scriptmanager to the masterpage of the template but doesn't work.

    PLEASE HELP!

     

     

  • Rodion Novoselov 694 posts 859 karma points
    Nov 08, 2011 @ 21:03
    Rodion Novoselov
    0

    Hi, Kristian. I believe it's exactly what you're looking for:
     http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 21:13
    Kristian
    0

     

     

    H is still not working :(/

     

     

     

     

     

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 21:15
    Kristian
    0

    The webservice file is located in the route of the webpage   c:\inetpub\wwwroot\GetUserDetails.asmx  

    I have no clue how to fix this now.

     

    Do I need to add a scriptmanager somewhere?

     

  • Rodion Novoselov 694 posts 859 karma points
    Nov 08, 2011 @ 21:24
    Rodion Novoselov
    0

    It looks like a javascript error caused by missing some namespace. I would recommend to try to set InlineScript="true" for the ServiceReference and than to skim through the generated html (if everything is all right there should be generated javascript proxy objects for the web service). 

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 21:26
    Kristian
    0

    Ok,

    I will try that.. It works fine on my local project and there is no Namespace..

     

    Thanks for trying to help me!

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 21:28
    Kristian
    0

    I had this problem with the javascript when i remove the script reference from the scriptmanager.

    But it won't work in umbraco so I think there is some problemn with the scriptmanager.

    Do I need to add an scriptmanager somewhere or are it already added to some default masterpage?

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 21:36
    Kristian
    0

    I think I got a bit further..

    I added a scriptmanager to my page and kept the scriptmanagerproxy in the usercontrol

    Now it complained that the /App_Code/GetUserDetails.vb was missing.


    I added the file and now it complains that is not written in C#

     

    The files '/App_Code/XSLTsearch.cs' and '/App_Code/GetUserDetails.vb' use a different language, which is not allowed since they need to be compiled together.

  • Kristian 15 posts 35 karma points
    Nov 08, 2011 @ 22:25
    Kristian
    0

    I manage to fix it now.

     

    Added 

    <codeSubDirectories>

    <add directoryName="CSCode"></add>

    <add directoryName="VBCode"></add>

     

    </codeSubDirectories>

    in web.config under compilation.

    Now it worked fine!

     

    THx again!

  • acasado 3 posts 23 karma points
    Nov 09, 2011 @ 18:12
    acasado
    0

    Hi Kristian.

    Could you explain me where did you add the scriptmanager and how it was formed?

    I think that the scriptmanger must be alocated on "parent" page that contain the usercontrol, and the scriptManagerProxy must be alocated into the usercontrol, but i tryed that and it doesn't work.

    Thanks

  • Rodion Novoselov 694 posts 859 karma points
    Nov 09, 2011 @ 20:58
    Rodion Novoselov
    0

    Hi, Acasado. A ScriptManager can be actually placed anywhere, but there's a strict rule that there can be only one ScriptManager for the whole page (including any masterpages and child controls). A ScriptManagerProxy is for somehow to ease this restriction (for example if you already have a ScriptManager on the page but you need some specific script or web service references in a control that's going to be used on the same page). Personally I follow the pattern that if my project uses MS Ajax then I simply place a ScriptManager on the top-level master page so that not to burden myself with placing it on any page or a user control where it's required and resolving potential conflicts with having it twice on the same page accidently.

Please Sign in or register to post replies

Write your reply to:

Draft