ResponseScripts.Add can not work

4 posts, 0 answers
  1. Jack
    Jack avatar
    7 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post


    In one of my page,I use "RadAjaxManager.GetCurrent(Page).ResponseScripts.Add" to add some script.
    What makes me amazing,the script can not work at all.

    the client script:
    function moveToTargetAnchor(anchorName) {
                var anchor = $('a[name="' + anchorName + '"]');
                if (anchor.length > 0) {
                var editor = $find("<%=editConent.ClientID%>");
                if (editor != null) {
                    var anchorElement = editor.get_document().getElementsByName(anchorName);
                    if (anchor != null) {
    the server:
    RadAjaxManager.GetCurrent(Page).ResponseScripts.Add("moveToTargetAnchor(""" & item.Title & """);")

    The code complete a function of going to spesific anchor.
    I have a test:
    when i add a "alert('123')" to the end of script,the page could go to right anchor at first;
    but after displaying '123',the page looks like being refreshed.

    How could this happen,anyone can help me?

    Best regards,

  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 03 Sep 2012 Link to this post

    Hello Jack,

    Please try to use the ScriptManager.RegisterStartupScript method as described in the topic below and verify if this makes any difference:

    All the best,
    Maria Ilieva
    the Telerik team
    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 their blog feed now.
  3. Sivajith
    Sivajith avatar
    4 posts
    Member since:
    Nov 2013

    Posted 19 Dec 2013 Link to this post


    i am facing an issue regarding calling notification plugin ' Noty ' functions and also the funtion in jquery.

    for example if i write function myfun()
    { alert("hai");

    and call from code behind , it works perfectly for the code 


    So what should i do to execute a script like

        function noty_error(type_,text_) {
                    var n = noty({
                            text: text_,
                         type: type_,
                            dismissQueue: true,
                            layout: 'topCenter',
                     theme: 'defaultTheme',
    using the code
    RadAjaxManager1.ResponseScripts.Add(@"noty_error('warning','Not entered anything');");

  4. Sivajith
    Sivajith avatar
    4 posts
    Member since:
    Nov 2013

    Posted 19 Dec 2013 Link to this post


    its some thing related to format issue.
    it will be working fine if we write it as

    RadAjaxManager1.ResponseScripts.Add(@"noty_error(""success"",""Operation completed successfully"");");
Back to Top