Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
 
My Error is:
 Microsoft JScript runtime error: Unable to get value of the property '_staticInstance': object is null or undefined.
 

My asmx service code:
[WebMethod]
       public string RedirectToLogin(string UserControl, string language, string country, string steps)
       {
           string redirectpage = string.Empty;
           Langauge.RequestRedirectPage Rp = new Langauge.RequestRedirectPage();
           redirectpage = Rp.getRedirectPage(UserControl, language, country, steps);
           return redirectpage.ToString();
       }
 

My Javascript code:
 
function load123() {
        Namespace1.RedirectToLogin("Registration", "dk", "denmark", "step2", onSuccess123, onfailedfun);
    }
 

function onSuccess123(resul) {
    window.location = resul;
    }
    function onfailedfun(res) {
    }
 
service calling from aspx page:
 
<asp:ScriptManager ID="ScriptManager2" runat="server">
           <Services>
               <asp:ServiceReference Path="~/Shop.asmx" />
           </Services>
       </asp:ScriptManager>
 
Runtime getting from JSDebug[dynamic] page:
Shop._staticInstance.RedirectToLogin(UserControl,language,country,steps,onSuccess,onFailed,userContext); }
 
thanks in advance.
Posted 9-Jul-13 4:34am
Edited 9-Jul-13 5:08am
v4
Comments
aspnet -i at 9-Jul-13 9:36am
   
I am also not able to understand the reason because I cant see any code...
ryanb31 at 9-Jul-13 9:51am
   
Use the improve question link, post the relevant code, and show us where it is happening. Otherwise, how can we know why?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Usually if you are calling a method from asmx to be used in jquery it should be static method.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Make the method RedirectToLogin as static like
 public static string RedirectToLogin(string UserControl, string language, string country, string steps)
 
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 406
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 205
3 Raul Iloc 170
4 Maciej Los 164
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100