RegisterClientScriptBlock not inserting script in RadWindow

6 posts, 0 answers
  1. hkdave95
    hkdave95 avatar
    245 posts
    Member since:
    Nov 2006

    Posted 21 Oct 2007 Link to this post

    Hi

    I have put the following RegisterClientScriptBlock into a Window to automate closing of the window after a login has been Authenticated.

    Call Telerik.Web.UI.RadScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType, "RadCloseWindow", "alert('Hello'); RadCloseWindow();", True) 

    NB: I am using Membership with this login and therefore I have a "Login" control and "LayoutTemplate" on this page.

    Kind Regards

    David
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 22 Oct 2007 Link to this post

    Hi hkdave95,

    I just checked the code and did not have the problem. Please, find my sample page attached.

    I want to note that RadScriptManager (although appearing in the Toolbox in the first release) is not public yet. You should use ScriptManager.RegisterClientScriptBlock instead.

    Let me know if I am missing something.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. hkdave95
    hkdave95 avatar
    245 posts
    Member since:
    Nov 2006

    Posted 22 Oct 2007 Link to this post

    Hi

    Could you try putting a simple "Login" form onto your webpage.

    Mabye this is causing the incorrect behaviour.

    Kind REgards

    David
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 25 Oct 2007 Link to this post

    Hi David,

    We were not able to reproduce the problem even with the Login form - everything is working as expected.

    Please open a new support ticket and send us a small sample application where the problem can be reproduced. We will check it and do our best to help.




    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Beth
    Beth avatar
    1 posts
    Member since:
    Jan 2008

    Posted 11 Feb 2008 Link to this post

    Hi All,
    I'm wondering if my problem is related to this or if I should open a new thread.

    We would also like to use the radalert to popup when the login attempt is unsuccessful (also using the asp.net login control).  I tried to use the OnLoginError method and the RegisterClientScriptBlock method to render the 'radalert' javascript call.  I was getting an "object not found" or similar error.

    I then realized when looking at the source that the alert call was generated at the top of the page and the include source for the javascript for the RadWindow control is at the bottom of the page.  So the function to popup the alert isn't available when the alert is called (from the top of the page).

    Is there anyway to get the RegisterClientScriptBlock to generate the code at the bottom of the page or the javascript includes for the rad controls to be at the top?

    Please let me know if that wasn't clear and thanks for your time,
    Beth
  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 11 Feb 2008 Link to this post

    Hello Beth,

    Indeed you are right - the fact that the RadWindowManager is not fully rendered on the page when you call radalert is the most likely reason for such problem.

    The recommended solutions vary depending on the type of the control that you are using:
    1. RadWindow for ASP.NET: Please check the following KB article: http://www.telerik.com/support/kb/article/b454K-gtd-b454T-cec-b454c-cec.aspx
    2. RadWindow for ASP.NET AJAX: The controls in the Prometheus suite are built upon the MS AJAX framework and the framework itself creates its controls (including RadWindow Prometheus) in the Sys.Application.add_init() method - you can check this for yourself by examining the HTML dump of a page with RadControls Prometheus included in it (or any other ASP.NET AJAX control).
      That is why when you call your code when the page is loaded, the RadWindowManager will still not be fully rendered on the page and you will get the error. To avoid this issue, you can either execute your code with a small timeout or better - to add your code in the Sys.Application load handler as shown below:

        protected void RadAlertButton_Click(object sender, EventArgs e)  
          {  
              ScriptManager.RegisterStartupScript(Page, typeof(Page), "RadAlertScript""Sys.Application.add_load(function(){radalert('test');});"true);  
          } 




    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017