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

[Solved] Ajax Problems With Grid In User Control On Update

2 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 25 Aug 2009, 05:45 PM
I have a user control that contains a rad grid that seems to be working great except after update.

In the user control, I register an javascript call on the updatecommand:

(Page.Master.FindControl("RadAjaxMasterManager1") as Telerik.Web.UI.RadAjaxManager).ResponseScripts.Add(statusScript);

The script calls a javascript function that does this:

        var ajaxMgr = $find("<%=RadAjaxManager.GetCurrent(Page).ClientID %>");
        ajaxMgr.ajaxRequest("ToDoRefreshAjax"); 

stepping through the code, the RaisePostBackEvent that I use to handle this runs correctly.  However when its all done running i get this javascript error:

Uncaught Sys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null.
Parameter name: id 
ScriptResource.axd:3098

and then all ajax calls stop working after this error

What is causing this error?

2 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 25 Aug 2009, 06:48 PM
After further investigation I found the cause, though I'm not sure how to fix it or if I'm doing this wrong.

Inside of my user controls on their Page_Load event I call this:

        RadAjaxManager.GetCurrent(Page).ClientEvents.OnRequestStart = "RequestStart";
        RadAjaxManager.GetCurrent(Page).ClientEvents.OnResponseEnd = "ResponseEnd";

with these methods in the aspx page with this:

var currentLoadingPanel = null
    var currentUpdatedControl = null
    function RequestStart(sender, args) { 
        var uniqueid = args.get_eventTarget(); 
        //alert(uniqueid); 
        currentLoadingPanel = $find("<%=RadAjaxLoadingPanel1.ClientID%>"); 
        if (uniqueid == "<%=LinkButton_PagingComments.UniqueID%>") { 
            currentUpdatedControl = "<%=CommentPanel.ClientID%>"
            currentLoadingPanel.show(currentUpdatedControl); 
        } 
        else if (uniqueid.indexOf("<%=CommentGrid1.CommentRadGrid.UniqueID%>") >= 0) { 
            currentUpdatedControl = "<%=CommentPanel.ClientID%>"
            currentLoadingPanel.show(currentUpdatedControl); 
        } 
        else if (uniqueid.indexOf("<%=ToDoGrid.ToDoRadGrid.UniqueID%>") >= 0) { 
            currentUpdatedControl = "<%=GridPanel.ClientID%>"
            currentLoadingPanel.show(currentUpdatedControl); 
        }         
    } 
    function ResponseEnd() { 
        //hide the loading panel and clean up the global variables 
        if (currentLoadingPanel != null
            currentLoadingPanel.hide(currentUpdatedControl); 
        currentUpdatedControl = null
        currentLoadingPanel = null
    }  
 

So I think the issue might in how I'm doing this.  When the user control posts back, will this screw up the loading panels?
0
John
Top achievements
Rank 1
answered on 25 Aug 2009, 06:54 PM
I have it working without the RequestStart Response End using just the normal loading panel call, but if I wanted to use the RequestStart/ResponseEnd inside a user control whats the best approach?
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Share this question
or