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

Can't get consistent behaviour using RadAjaxManager

4 Answers 67 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 08 Sep 2009, 03:03 PM
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




4 Answers, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 1
answered on 09 Sep 2009, 12:37 PM
Anybody? I'd really appreciate some advice here.

Thanks,

Rick
0
Mira
Telerik team
answered on 10 Sep 2009, 03:30 PM
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.
 
0
Rick
Top achievements
Rank 1
answered on 11 Sep 2009, 10:09 AM
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!
0
Mira
Telerik team
answered on 14 Sep 2009, 02:52 PM
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.
Tags
Ajax
Asked by
Rick
Top achievements
Rank 1
Answers by
Rick
Top achievements
Rank 1
Mira
Telerik team
Share this question
or