Can't get consistent behaviour using RadAjaxManager

5 posts, 0 answers
  1. Rick
    Rick avatar
    7 posts
    Member since:
    May 2009

    Posted 08 Sep 2009 Link to this post

    Hi,

    I'm struggling to get a consistent way of Ajaxifying my controls and I'm wondering if there's an approach you can recommend for me. Here's my setup:

    I have a Master page with code:

     protected override void OnInit(EventArgs e) 
            { 
                base.OnInit(e); 
     
                _radAjaxManager = new RadAjaxManager(); 
                _radAjaxManager.ID = "radAjaxManager"
                _radAjaxManager.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline; 
                form1.Controls.Add(_radAjaxManager); 
     
                _radAjaxLoadingPanel = new RadAjaxLoadingPanel(); 
                _radAjaxLoadingPanel.ID = "radAjaxLoadingPanel"
                _radAjaxLoadingPanel.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center; 
                _radAjaxLoadingPanel.Transparency = 20; 
                _radAjaxLoadingPanel.BackColor = Color.WhiteSmoke; 
                //_radAjaxLoadingPanel.BackImageUrl = "/Images/ajax-loader.gif"; 
                Image img = new Image(); 
                img.ImageUrl = "/Images/ajax-loader.gif"
                _radAjaxLoadingPanel.Controls.Add(img); 
                 
                form1.Controls.Add(_radAjaxLoadingPanel); 
            } 
     
     
         public void AjaxifyControl(Control ajaxifiedControl, Control updatedControl) 
            { 
                radAjaxManager.AjaxSettings.AddAjaxSetting(ajaxifiedControl, updatedControl, radAjaxLoadingPanel); 
            } 

    I've then got a web content page that uses a series of user controls in the aspx such as:

    <uc:WinTextBox ID="txtAddress1" Name="Address1" runat="server"  Required="true" TabIndex="33" /> 
    <uc:WinTextBox ID="txtAddress2" Name="Address2" runat="server"  Required="true" TabIndex="34"/> 
     

    I have a button that I want to do an Ajax postback and update these user control textboxes. I have the following code on the page load of my content page:

                Master.AjaxifyControl(btnFindMyAddress, txtAddress1); 
                Master.AjaxifyControl(btnFindMyAddress, txtAddress2); 

    I've had this working before by wrapping the address details area in a RadAjaxPanel but since I read your article at http://www.telerik.com/help/aspnet-ajax/ajxcontrolsinajaxpanelandajaxsettings.html I removed the AjaxPanels. Now though I have the following problems:

    1) The loading image in the LoadingPanel is not displaying.
    2) The controls aren't updating properly. There seems to be a copy of the controls that are going to be updating being spawned.

    When I did have the RadAjaxPanel on the page the behaviour seemed to work better but I want to hear your suggestions on how to make this work consistently every time.

    Thanks in advance,

    Rick




  2. Rick
    Rick avatar
    7 posts
    Member since:
    May 2009

    Posted 09 Sep 2009 Link to this post

    Anybody? I'd really appreciate some advice here.

    Thanks,

    Rick
  3. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 10 Sep 2009 Link to this post

    Hi Rick,

    I recommend that use set the RadAjaxManager settings in the master page using the following code:
     RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(Button1, WebUserControl1); 

    I am also attaching a sample project implementing your scenario which is working fine on my side - the webcontrol is being updated each time correct.

    Best wishes,
    Mira
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
     
  4. Rick
    Rick avatar
    7 posts
    Member since:
    May 2009

    Posted 11 Sep 2009 Link to this post

    Hi,

    Thanks for the reply.

    However, when I run the sample provided there's no loading panel image displayed. The user control is updated but there's no loading image. I've tried adding a Thread.Sleep(1000) to the button click in case the display time was too short but still couldn't see the loading panel.

    I've tried your sample on two machines:
    1) VS 2008 NET 3.5 SP1. Windows Server 2008.
    2) VS 2010 Net 4.0. Windows Server 2008.

    I've tried this with Firefox & IE on both machines ..... any ideas, please can you help!
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 14 Sep 2009 Link to this post

    Hello Rick,

    For the loading panel to show, I suggest you to wrap the user control in a asp:panel and update the panel on button click.
    I am also attaching a modification of the project with the loading panel showing successfully.

    I hope this helps.

    Kind regards,
    Mira
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top