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

RadAjaxManager and RegisterStartupScript

3 Answers 178 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
ithihas
Top achievements
Rank 1
ithihas asked on 12 Jul 2012, 08:18 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.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2012, 07:07 AM
Hello,

When programming in  MS AJAX environment the scripts should be register with ScriptManager instead of page's ClientScriptManager. Check the following help documentation and demo which explains using ajax with master pages and content pages.

Thanks,
Shinu.

0
pedrotti
Top achievements
Rank 1
answered on 25 Sep 2013, 08:52 AM
Hi Shinu,

Could give me a simple but complete exemple
In the demo, I do not see where you use ScriptManager. RegisterStartupScript.
I tried several tests, but he has to miss me some parameters because that does not work.

Thank you for your help

Anne
0
Maria Ilieva
Telerik team
answered on 27 Sep 2013, 12:03 PM
Hello,

Revise the help topic below for more information on registering client scripts with Ajax:
http://www.telerik.com/help/aspnet-ajax/ajax-execute-custom-javascript.html

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
ithihas
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
pedrotti
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or