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

RadAjaxManager and RegisterStartupScript

3 Answers 695 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 13 May 2009, 08:36 AM
Hi All,

I have a Probelm.

On my ASPX Site I have an 
          RadAjaxManager 
          RadAjaxLoadingPanel

                    <telerik:RadAjaxLoadingPanel   
                        ID="RadAjaxLoadingPanel1"   
                         BackgroundPosition="Top" 
                        runat="server" 
                        IsSticky="true" 
                        Skin="Office2007" /> 
 
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                        <ajaxsettings> 
                            <telerik:AjaxSetting AjaxControlID="FormView1">  
                                  
                                <updatedcontrols> 
                                    <telerik:AjaxUpdatedControl   
                                        ControlID="FormView1"   
                                        LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                </updatedcontrols> 
                              
                            </telerik:AjaxSetting> 
                        </ajaxsettings> 
                    </telerik:RadAjaxManager> 

In the code behind I register some javascripts by setting RegisterStartupScript

            protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e)  
            {  
 
                switch (e.CommandName)  
                {  
                    case "Cancel":  
                        //ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);  
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "alertScript""alert('test');"true);  
                        break;  
 
                    case "Update":  
                        ClientScript.RegisterStartupScript(Page.GetType(), "mykey""CloseAndRebind();"true);  
                        break;  
 
                    case "Insert":  
                        ClientScript.RegisterStartupScript(Page.GetType(), "mykey""CloseAndRebind('navigateToInserted');"true);  
                        break;  
 
                }  
 
            } 

But this script only fired if I remove the radajaxmanager.
What's wrong here?

And second. Is there a good example on how I use the ajaxmanger in combination with master and contentpages.


Thanks for help.

Christian

3 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 15 May 2009, 11:43 AM
Hello Uwe,

As you may know when programming in  MS AJAX environment the scripts should be register with ScriptManager instead of page's ClientScriptManager. For more information please refer to this msdn article under Registering Partial-Page Update Compatible Scripts section.

As to your other question please refer to this online demo for a demonstration of master page scenario.

All the best,
Rosen
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
Christian
Top achievements
Rank 1
answered on 16 May 2009, 03:42 PM
Hi Rosen,

thanls a lot. This hint solved my problem. :)

Regards
Christian
0
Simone
Top achievements
Rank 1
answered on 13 Feb 2012, 04:25 PM
Solved mine too.

Changed from:
Page.ClientScript.RegisterStartupScript(this.GetType(), "ProgramUpdated", "SetArgumentValue(" + "'ProgramUpdated'" + ");", true);
to:
ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgramUpdated", "SetArgumentValue(" + "'ProgramUpdated'" + ");", true);
Tags
Ajax
Asked by
Christian
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Christian
Top achievements
Rank 1
Simone
Top achievements
Rank 1
Share this question
or