RadGrid Won't Refresh AjaxRequest

6 posts, 1 answers
  1. Sasha
    Sasha avatar
    10 posts
    Member since:
    Sep 2013

    Posted 15 Sep 2014 Link to this post

    I have the following RadAjaxManager defined in my page. The problem is once a user enters some text in the RadModalPopup, I want the RadGrid to refresh when the modalpopup closes. It currently is not, any ideas as to why not?

               function closeRadWindow() {
     
                   $find("<%= RadAjaxManager.ClientID %>").ajaxRequest();
     
               }
     
     
     
           </script>  
     
       </TELERIK:RADCODEBLOCK>
     
       <telerik:RadWindowManager ID="RadWindowManager" runat="server">
     
            <Windows>
     
                <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Title="Add New Description to Table" Width="400px" Height="150" Behaviors="Close, Move" OnClientClose="closeRadWindow">
     
                    <ContentTemplate>
     
                       <asp:Label ID="Description" runat="server" Text="New Description: "></asp:Label>
     
                       <asp:TextBox ID="NewDescriptionTextBox" runat="server" Width="300px"></asp:TextBox>
     
                        <asp:Button ID="AddNewDescriptionButton" runat="server" Text="Add" OnClick="AddNewDescriptionButton_Click" /><br /><br />
     
                        <asp:Button ID="CancelAddDescriptionButton" runat="server" Text="Cancel" />
     
                        <asp:Label ID="messageLabel" runat="server" Text="Label" Visible="false"></asp:Label>
     
                    </ContentTemplate>
     
                </telerik:RadWindow>
     
            </Windows>
     
        </telerik:RadWindowManager>
     
     
     
           <telerik:RadAjaxManager runat="server" ID="RadAjaxManager" DefaultLoadingPanelID="RadAjaxLoadingPanel" OnAjaxRequest="RadAjaxManager_AjaxRequest">
     
               <AjaxSettings>
     
                   <telerik:AjaxSetting AjaxControlID="AdminHoldReasonGrid">
     
                       <UpdatedControls>
     
                           <telerik:AjaxUpdatedControl ControlID="AdminHoldReasonGrid" />
     
                       </UpdatedControls>
     
                   </telerik:AjaxSetting>
     
     
     
                   <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
     
                       <UpdatedControls>
     
                           <telerik:AjaxUpdatedControl ControlID="AdminHoldReasonGrid" />
     
                       </UpdatedControls>
     
                   </telerik:AjaxSetting>
     
               </AjaxSettings>
     
           </telerik:RadAjaxManager>
     
     
     
     
     
     
     
    THIS IS THE RELEVANT CODE BEHIND
     
     
           protected void RadAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
     
           {
     
               AdminHoldReasonGrid.MasterTableView.SortExpressions.Clear();
     
               AdminHoldReasonGrid.Rebind();
     
           }
  2. Sasha
    Sasha avatar
    10 posts
    Member since:
    Sep 2013

    Posted 16 Sep 2014 in reply to Sasha Link to this post

    Here is a little more information that I just found out. The onclientcloseevent does run but only when clicking on the x button on the modalpopup. The modal popup is being used to add a record to the grid, I assumed it would run after the popup closed but that is not the case as I have a add button on the modal popup that adds information to the grid and then the popup just closes not triggering the onclientcloseevent.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sasha
    Sasha avatar
    10 posts
    Member since:
    Sep 2013

    Posted 16 Sep 2014 in reply to Sasha Link to this post

    Any idea how to get the grid to refresh after clicking the add button in the modal popup?
  5. Sasha
    Sasha avatar
    10 posts
    Member since:
    Sep 2013

    Posted 17 Sep 2014 in reply to Sasha Link to this post

    Got initial update to work using the following code:

    <telerik:RadWindowManager ID="RadWindowManager" runat="server">
         <Windows>
             <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Title="Add New Description to Table" Width="400px" Height="150" Behaviors="Close, Move" OnClientClose="closeRadWindow">
                 <ContentTemplate>
                    <asp:Label ID="Description" runat="server" Text="New Description: "></asp:Label>
                    <asp:TextBox ID="NewDescriptionTextBox" runat="server" Width="300px"></asp:TextBox>
                     <asp:Button ID="AddNewDescriptionButton" runat="server" Text="Add" OnClick="AddNewDescriptionButton_Click" /><br /><br />
                     <asp:Button ID="CancelAddDescriptionButton" runat="server" Text="Cancel" />
                     <asp:Label ID="messageLabel" runat="server" Text="Label" Visible="false"></asp:Label>
                 </ContentTemplate>
             </telerik:RadWindow>
         </Windows>
     </telerik:RadWindowManager>


    The add new button click event is:

    AdminHoldReasonGrid.MasterTableView.SortExpressions.Clear();
    AdminHoldReasonGrid.Rebind();


    The Add button is:
    <asp:Button ID="addRecommendationButton" runat="server" Text="Add Recommendation" OnClientClick="togglePopupModality(); return false;"  />


    Here is the function:
    function togglePopupModality() {
        window.radopen(null, "RadWindow1");
    }


    Problem now is that the first time it will update properly but the second time, I click the button in order to save, it is unable to get handle of radwindow. I get an unhandled exception from the Telerik.Web.UI.WebResource.AXD










  6. Answer
    Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 18 Sep 2014 Link to this post

    Hello Sasha,

    I believe it may be helpful if you check the following live sample:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Sasha
    Sasha avatar
    10 posts
    Member since:
    Sep 2013

    Posted 18 Sep 2014 in reply to Eyup Link to this post

    Actually there was no issue when I actually published and ran from intranet. Popups work perfectly when running from server.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017