RadAjaxManager and RegisterStartupScript

4 posts, 1 answers
  1. Christian Pardun
    Christian Pardun avatar
    112 posts
    Member since:
    May 2010

    Posted 13 May 2009 Link to this post

    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
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 15 May 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Christian Pardun
    Christian Pardun avatar
    112 posts
    Member since:
    May 2010

    Posted 16 May 2009 Link to this post

    Hi Rosen,

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

    Regards
    Christian
  5. Simone
    Simone avatar
    34 posts
    Member since:
    Mar 2011

    Posted 13 Feb 2012 Link to this post

    Solved mine too.

    Changed from:
    Page.ClientScript.RegisterStartupScript(this.GetType(), "ProgramUpdated", "SetArgumentValue(" + "'ProgramUpdated'" + ");", true);
    to:
    ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgramUpdated", "SetArgumentValue(" + "'ProgramUpdated'" + ");", true);
Back to Top