+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Backend Page From Custom Module and AJAX

Backend Page From Custom Module and AJAX

2 posts, 1 answered
  1. Merritt
    Merritt avatar
    31 posts
    Registered:
    11 Mar 2011
    29 Apr 2015
    Link to this post
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ProductionsModuleItemsMaster">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ProductionsModuleItemsMaster" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>

     

    I added the ​above code to a user control auto-generated by the thunder wizard for adding a custom content type to a custom module; ModuleProject/Web/UI/<ContentType>sDetails.ascx

    The RadGrid "ProductionsModuleItemsMaster" is not ajax-ified yet I enabled viewstate from backend pages and checked the box for including a script manager; the page does a full postback when interacting with the RadGrid, ProductionsModuleItemsMaster.

    I then tried to programmatically attach the ajax setting to a standard button and it spit out something about a null value (the commented out line didnt work), so i manually created the ajax setting and it didnt encounter an error but the button is not ajax-ified:

     

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        var setting = new AjaxSetting();
        AjaxUpdatedControl target = new AjaxUpdatedControl(Button1.ID, RadAjaxLoadingPanel1.ID);
        setting.UpdatedControls.Add(target);
        setting.AjaxControlID = Button1.ID;
        RadAjaxManager1.AjaxSettings.Add(setting);
        //RadAjaxManager1.AjaxSettings.AddAjaxSetting(Button1, Button1, RadAjaxLoadingPanel1);
    }

  2. Merritt
    Merritt avatar
    31 posts
    Registered:
    11 Mar 2011
    30 Apr 2015
    Link to this post

    Without going into details, I resolved the issue by using this instead of radajaxmanger:

     

        public class CustomRadAjaxManager : RadAjaxManager
        {
            protected override void OnInit(EventArgs e)
            {
                this.Page.InitComplete += new EventHandler(Page_InitComplete);
            }
            void Page_InitComplete(object sender, EventArgs e)
            {
                base.OnInit(e);
            }
        }

     

    Also, you'll need to set the enclosing div tag of the RadGrid to runat="server"

    Answered
2 posts, 1 answered