RadAjaxManager and RegisterStartupScript

4 posts, 0 answers
  1. ithihas
    ithihas avatar
    14 posts
    Member since:
    Jun 2012

    Posted 12 Jul 2012 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.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jul 2012 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. LEVEFAUDE
    LEVEFAUDE avatar
    39 posts
    Member since:
    Apr 2011

    Posted 25 Sep 2013 Link to this post

    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
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Sep 2013 Link to this post

    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.
Back to Top