ModalPopupExtender and RadAjaxManagerProxy

7 posts, 0 answers
  1. Magnus Lund
    Magnus Lund avatar
    5 posts
    Member since:
    Nov 2008

    Posted 11 Jun 2010 Link to this post

    Hi

    Have a page which loads a user control using the RadAjaxManager. This user control contains a ModalPopupExtender. 

    ModalPopupExtender is triggered to show (server side) when clicking a button within the loaded user control.

    The modal dialog (panel) which ModalPopupExtender extends is shown without problems, but  whenever any button within modal dialog is clicked the following exception occurs server side:    

    System.ArgumentException: Invalid JSON primitive: . atSystem.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()atSystem.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32depth) atSystem.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(Stringinput, Int32 depthLimit, JavaScriptSerializer serializer) atSystem.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializerserializer, String input, Type type, Int32 depthLimit) atSystem.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject(Stringinput) at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey,NameValueCollection postCollection) atTelerik.Web.UI.RadInputControl.LoadPostData(String postDataKey,NameValueCollection postCollection) atTelerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(StringpostDataKey, NameValueCollection postCollection) atSystem.Web.UI.Page.ProcessPostData(NameValueCollection postData,Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Implementation is based on the examples in this forum.

    Any ideas on how to resolve this?

    Best regards,

    /Magnus
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Jun 2010 Link to this post

    Hello,

    Could you please let me know whether the error appear if the ajax is disabled on the page and also if regular asp UpdatePanel is used instead of RadAjax?
    Please find attached a sample application which demonstrates how you can ajaxify buttons of ModalPopupExtender.


    Regards,
    Maria Ilieva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Magnus Lund
    Magnus Lund avatar
    5 posts
    Member since:
    Nov 2008

    Posted 23 Jun 2010 Link to this post

    Hi Maria

    Thank you for your response.

    My code works fine when ajax is disabled for the page through the RadAjaxManager.

    I've compiled and run the code that you attached. This code also has errors. The code doesn't generate the error that i'm currently experiencing, but it generates several javascript errors. 

    Best regards,

    Magnus
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Jun 2010 Link to this post

    Hello,

    Have you tested to use regular asp UpdatePanel with the ModalPopupExtender, as I suppose that the problem is ajax generic problem and not directly related to Telerik RadAjax?
    Also please let me know what errors exactly you are receiving in the project I have sent you, as my local test are working correctly.


    Greetings,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Magnus Lund
    Magnus Lund avatar
    5 posts
    Member since:
    Nov 2008

    Posted 25 Jun 2010 Link to this post

    Hi Maria,

     

    Using a regular asp UpdatePanel with the ModalPopupExtender still generates the same error:

     

    System.ArgumentException: Invalid JSON primitive: . at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject() at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject(String input) at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection) at Telerik.Web.UI.RadInputControl.LoadPostData(String postDataKey, NameValueCollection postCollection) at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   

     

    In regards to the errors I’m receiving in your example project; I receive the following error when clicking ‘lbEditDocInfo’:

     

    Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

     

    The error occurs in:

     

    var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {

        /// <summary locid="M:J#Sys.UI.DomEvent.removeHandler" />

        /// <param name="element"></param>

        /// <param name="eventName" type="String"></param>

        /// <param name="handler" type="Function"></param>

        var e = Function._validateParams(arguments, [

            {name: "element"},

            {name: "eventName", type: String},

            {name: "handler", type: Function}

        ]);

        if (e) throw e;

        Sys.UI.DomEvent._ensureDomNode(element);

        var browserHandler = null;

        if ((typeof(element._events) !== 'object') || (element._events == null)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);

        var cache = element._events[eventName];

        if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);

        for (var i = 0, l = cache.length; i < l; i++) {

            if (cache[i].handler === handler) {

                browserHandler = cache[i].browserHandler;

                break;

            }

        }

        if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);

        if (element.removeEventListener) {

            element.removeEventListener(eventName, browserHandler, false);

        }

        else if (element.detachEvent) {

            element.detachEvent('on' + eventName, browserHandler);

        }

        cache.splice(i, 1);

    }

    Best regards,

    Magnus

  6. Damian
    Damian avatar
    2 posts
    Member since:
    Jul 2010

    Posted 16 Aug 2010 Link to this post

    Hi, Can you please advise if you were able to resolve the issue below, I am experiencing the same issue?

    Thanks
    D
  7. Magnus Lund
    Magnus Lund avatar
    5 posts
    Member since:
    Nov 2008

    Posted 16 Aug 2010 Link to this post

    Hi Damian,

    I havn't been able to resolve the issue, as I've yet to discover the root cause. But a possible workaround is to use the AJAX.NET scriptmanager and update panels instead, but that may or may not cause issues in other areas depending on the project.

    Best regards,

    Magnus 
Back to Top