This is a migrated thread and some comments may be shown as answers.

ModalPopupExtender and RadAjaxManagerProxy

6 Answers 141 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Magnus Lund
Top achievements
Rank 1
Magnus Lund asked on 11 Jun 2010, 02:36 PM
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

6 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Jun 2010, 02:02 PM
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.
0
Magnus Lund
Top achievements
Rank 1
answered on 23 Jun 2010, 12:08 PM
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
0
Maria Ilieva
Telerik team
answered on 25 Jun 2010, 11:30 AM
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
0
Magnus Lund
Top achievements
Rank 1
answered on 25 Jun 2010, 01:16 PM

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

0
Damian
Top achievements
Rank 1
answered on 16 Aug 2010, 07:46 PM
Hi, Can you please advise if you were able to resolve the issue below, I am experiencing the same issue?

Thanks
D
0
Magnus Lund
Top achievements
Rank 1
answered on 16 Aug 2010, 08:58 PM
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 
Tags
Ajax
Asked by
Magnus Lund
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Magnus Lund
Top achievements
Rank 1
Damian
Top achievements
Rank 1
Share this question
or