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

Adding RadScriptManager in Control/CodeBehind

2 Answers 227 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
pev
Top achievements
Rank 1
pev asked on 30 Apr 2009, 08:26 AM
Hello!

I am trying to create my own Page class which all my pages will inherit from instead of System.Web.UI.Page. This is so that can add different controllers and do various settings on all pages through many different projects (I know about Master pages and I use that as well, but this is used between various projects).

The problem is when I try to add the RadScriptManager via my own Page class, some of the RadAjaxPanels will not work and it is like the page is sometimes acting a bit strange. It seems that the panels that are added via codebehind/Control classes works like they should, but the ones added in ASPX pages does not work. I have tried adding the RadScriptManager in both Init and Load, both before and after base.methodName(). I have also tried both Add and AddAt(0) on this.Form.Controls.

Is there any solution to adding the RadScriptManager in a .cs class/codebehind or are the controls dependent of it beging added (on top) in the ASPX page?

I am using version 2009.1.422.20.

Thank you.

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 30 Apr 2009, 02:46 PM
Hi pev,

Normally adding the script manager during OnInit (make sure it is the first control in the form) should do the trick. Could you provide some more info when this fails? Ideally you could paste some code here.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
pev
Top achievements
Rank 1
answered on 05 May 2009, 07:22 AM
I cannot post the whole page and controller here, but here is the setup we had:

Our page class:
public class MyPage : Page  
{  
 
  override onInit()  
  {  
    base.onInit();  
    Page.Form.Controls.AddAt(0, ScriptManager);  
  }  
 
    

Then we inherited from this class instead of Page in our pages:
public partial class _Default : MyPage  
{  
 

And our aspx page:
<form id="form1" runat="server">  
 
<Lib:MyAjaxLoadingPanel runat="server" ID="ajaxLoadingPanel1"></Lib:MyAjaxLoadingPanel> 
<div> 
  <div> 
    <fieldset> 
    <legend>Header</legend> 
      <telerik:RadAjaxPanel ID="rapSeller" runat="server" LoadingPanelID="ajaxLoadingPanel1">  
 
       MyContent  
 
       </telerik:RadAjaxPanel> 
     </fieldset> 
  </div> 
</div> 
 
</form> 

The setup was ike this but with a lot more complex pages and other controls. And whenever trying to add my Scriptmanager in the page class, the RadAjaxPanels would not work, the ones added in the ASPX atleast.

We decided to add the Scriptmanager in a controller instead, and then we add this controller to every aspx page we have.

Thanks for you help!
Tags
ScriptManager and StyleSheetManager
Asked by
pev
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
pev
Top achievements
Rank 1
Share this question
or