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

RadGrid Won't Refresh AjaxRequest

5 Answers 231 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Sasha
Top achievements
Rank 1
Sasha asked on 16 Sep 2014, 12:06 AM
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();
 
       }

5 Answers, 1 is accepted

Sort by
0
Sasha
Top achievements
Rank 1
answered on 16 Sep 2014, 12:28 PM
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.
0
Sasha
Top achievements
Rank 1
answered on 16 Sep 2014, 05:41 PM
Any idea how to get the grid to refresh after clicking the add button in the modal popup?
0
Sasha
Top achievements
Rank 1
answered on 17 Sep 2014, 08:31 PM
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










0
Accepted
Eyup
Telerik team
answered on 18 Sep 2014, 12:35 PM
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.

 
0
Sasha
Top achievements
Rank 1
answered on 18 Sep 2014, 03:17 PM
Actually there was no issue when I actually published and ran from intranet. Popups work perfectly when running from server.
Tags
Ajax
Asked by
Sasha
Top achievements
Rank 1
Answers by
Sasha
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or