I have a user control written in C# in a Telerik ajaxified page. I wrote a context menu using RadContextMenu and everything works fine except one of my menu items is "refresh". How can I refresh my user control from javascript? Basically it needs to some how force the TelerikAjaxManager to refresh my control.
Check out the documentation for their ajaxRequestWithTarget() client side function. It will let you simulate a postback from a control such as your menu item.
Use the RadAjaxManager's ajaxRequestWithTarget() method to submit an Ajax request to the server. By supplying the target to the function call, the RadAjaxManager will submit an asynchronous postback to the server, informing the server that the supplied control was the initiator of the postback. You can add the following event-handler when the context menu item is clicked:
function contextMenu_Refresh() {
var ajaxManager = $find('<%= RadAjaxManager.GetCurrent(this.Page).ClientID %>');
ajaxManager.ajaxRequestWithTarget('<%= MyControl.ClientID %>');
}
Keep in mind that you also must have wired up the appropriate Ajax settings in the RadAjaxManager, so that it will honor your request to update your control when the response is sent back from the server.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="MyControl">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="MyControl" />
<!-- Add other controls to be updated here -->
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Hope this helps.