Issue with RadAjaxManager and 2 RadGrids

5 posts, 0 answers
  1. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 11 Aug 2010 Link to this post

    I am having an issue with using RadAjaxManager to rebind 2 RadGrids. Here is basically how my page is setup:

    RadAjaxManager
       RadMultiPage
    RadPageView1
       RadGrid1
    RadPageView2
       RadGrid2

    What I want to happen is when closing a RadWindow I call a javascript function on the parent page and pass an argument to determine which RadGrid I want to rebind. This works fine when I am trying to update only 1 RadGrid and do not have the other RadGrid specified in the properties of the RadAjaxManager. I'm not sure if it doesn't work because I have setup the RadAjaxManager improperly or what, but I receive the following error every time I try to rebind a RadGrid via Javascript when closing a RadWindow. 

    Error: "Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ctl00_DefaultContentPlaceHolder_FMSContentPlaceHolder_ctl00_ctl00_
    DefaultContentPlaceHolder_FMSContentPlaceHolder_rgOrdersReceivedPanel'.
    If it is being updated dynamically then it must be inside another UpdatePanel."

    Here is my code:

    RadWindow Javascript to call refreshGrid function on parent page:
    function refreshGrid() {
              var oWindow = GetRadWindow();
              oWindow.BrowserWindow.refreshGrid("Inventory");
              oWindow.Close();
          }

    Parent Page Javascript:
    function refreshGrid(arg) {
                if (arg == "Rebind") {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else if (arg == "Inventory") {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Inventory");
                }
        }


    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgInventory" />
                        <telerik:AjaxUpdatedControl ControlID="rgOrdersReceived" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadWindowManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgInventory" />
                        <telerik:AjaxUpdatedControl ControlID="odsInventory" />
                        <telerik:AjaxUpdatedControl ControlID="odsInventoryReceived" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rgInventory">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="destroyWin" />
                        <telerik:AjaxUpdatedControl ControlID="rgInventory" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rgOrdersReceived">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgOrdersReceived" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                </AjaxSettings>
        </telerik:RadAjaxManager>

    Code Behind:
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "Rebind")
            {
                rgOrdersReceived.Rebind();
            }
            else if (e.Argument == "Inventory")
            {
                rgInventory.Rebind();
            }
        }


  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 16 Aug 2010 Link to this post

    Hi Casey,

    Could you please elaborate a bit more on your application. Are you using another ajax control (RadAjaxPanel or asp UpdatePanel) for updating the RadGrids except the RadAjaxManager control? Please note that using asp UpdatePanel or AjaxPanel and RadAjaxManager for updating the same part of the code is not supported scenario and it may lead to a lot of different issue.

    All the best,
    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. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 17 Aug 2010 Link to this post

    I am only using a RadAjaxManager.

    Here is basically what I have:

    RadMultiPage
    -RadPageView1
    --rgInventory - LinkButton inside GridTemplateColumn opens a RadWindow (RadWindow1).
    --RadWindow1 - The user enters some information and clicks save. This should insert the record (it is doing that), then it should call a javascript function to call javascript from the parent page to rebind "rgInventory" and finally close the RadWindow. When stepping through the code I see that it goes through the RadAjaxManager1_AjaxRequest server side event and calls the rgInventory.Rebind() code, however, after I step through all of the steps, I receive the error.  -RadPageView2
    --LinkButton1 - OnClick opens RadWindow2 for the user to enter a new order.
    --rgOrdersReceived
    --RadWindow2 - When the user clicks "Save" the order is inserted and rgOrdersReceived should be rebound to reflect the newly inserted order. The same things happens for this as it does for the first RadGrid. The RadWindow closes, and the rgOrdersReceived.Rebind() code is called, however, I receive the error once all of the code is stepped through. 

    I used to only have the scenario in RadPageView2 and it was working fine, then a new request came in to add the same functionality of opening a window to insert a record, then refreshing the main grid and closing the window, for the first RadPageView.
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Aug 2010 Link to this post

    Hello Casey,

    Could you please let me know what the result is if the Ajax is disabled on the page. Also could you please test the application using regular asp UpdatePanel for wrapping the needed content and verify what the result is.

    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. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 23 Aug 2010 Link to this post

    Maria,

    Instead of using RadAjaxManager, I changed my approach. I still execute a javascript function in the parent window when I close the RadWindow; however, that function doesn't initiate an AjaxRequest. I just do the below and it is working great!!

    function refreshRadGrid(){
           var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
           masterTable.rebind();
       }

    Thanks,
    Casey
Back to Top