locked
PageMethods not getting invoked RRS feed

  • Question

  • User574682207 posted

    Hello,

    I went through the older thread on PageMethods and tried everything, but still its not working, sometimes it makes call 1 out of 100 but i did't understood any pattern in that.

    If i don't pass any parameter then it makes the call, i checked parameter datatype its correct.

    I have doubt regarding browser compatability, currently i m using IE9 and 10, please let me kn do i need to do any setting in that.

    Cheers,

    Thursday, February 6, 2014 11:55 AM

Answers

  • User574682207 posted

    hi,

    i have tried this also, but as usual call to the pageMethod is not consistant, few times it makes the call and sometimes not. 

    Now i have changed the logic, i am using hidden variable to pass the value.

    thanks,

    Cheers.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 16, 2014 8:19 AM

All replies

  • User-1360095595 posted

    No setting needed. 

    Thursday, February 6, 2014 12:51 PM
  • User1734617369 posted

    Hi,

    Can you provide some code that we may check to see if anything is wrong?

    Best regards
    Johan

    Friday, February 7, 2014 4:42 AM
  • User574682207 posted

    then what could be the possible problem.

    Friday, February 7, 2014 7:11 AM
  • User574682207 posted

    Script code:

    function restore() {
    var vState = "";
    for (i = 0; i < document.forms[0].elements.length; i++) {
    var elm = document.forms[0].elements[i];
    if (elm.type == 'textarea' && elm.id.indexOf('CKEditorControl') > 0) {
    vState = CKEDITOR.instances[elm.id].getData();
    }
    }
    PageMethods.StoreData(vState);
    return false;
    }

    Aspx.cs code:

    [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public static void StoreData(object Value)
    {
    string value = Value.ToString();
    bool saveShiftHandoverData = DNCSSessionHelper.SaveShiftHandoverData == null;

    if (!saveShiftHandoverData)
    {
    DNCSSessionHelper.SaveShiftHandoverData.Clear();
    }
    DNCSSessionHelper.SaveShiftHandoverData = new Dictionary<string, string>();
    DNCSSessionHelper.SaveShiftHandoverData.Add("filename", "OEFieldList.aspx");
    DNCSSessionHelper.SaveShiftHandoverData.Add("data", value);

    }

    thanks,

    Friday, February 7, 2014 7:13 AM
  • User-760709272 posted

    It could be characters in the data in your editor making the call invalid.  Try making it url-friendly first

    vState = escape(CKEDITOR.instances[elm.id].getData());

    Friday, February 7, 2014 7:24 AM
  • User574682207 posted

    tried  it but no luck.

    Friday, February 7, 2014 11:21 AM
  • User-933407369 posted

    hi,

    I would suggest you try to change your StoreData method, like so :

    System.Web.Services.WebMethod]
     [System.Web.Script.Services.ScriptMethod]
     public static void StoreData(string Value)
     {
     string value = Value.ToString();
     bool saveShiftHandoverData = DNCSSessionHelper.SaveShiftHandoverData == null;
    
    if (!saveShiftHandoverData)
     {
     DNCSSessionHelper.SaveShiftHandoverData.Clear();
     }
     DNCSSessionHelper.SaveShiftHandoverData = new Dictionary<string, string>();
     DNCSSessionHelper.SaveShiftHandoverData.Add("filename", "OEFieldList.aspx");
     DNCSSessionHelper.SaveShiftHandoverData.Add("data", value);
    
    }
    

    please check out the link fro details:

    PageMethods Not getting Invoked

    http://forums.asp.net/t/1667235.aspx

    Hope it helps you.

    Thursday, February 13, 2014 3:16 AM
  • User574682207 posted

    hi,

    i have tried this also, but as usual call to the pageMethod is not consistant, few times it makes the call and sometimes not. 

    Now i have changed the logic, i am using hidden variable to pass the value.

    thanks,

    Cheers.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 16, 2014 8:19 AM