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

radalert (Object does not support this property or method)

2 Answers 90 Views
Window
This is a migrated thread and some comments may be shown as answers.
Maher
Top achievements
Rank 1
Maher asked on 20 Feb 2009, 03:08 PM
Can some one help me eith this problem. When I call radalert in my program I receive the following JavaScript error 

Object does not support this property or method

This is the code in my aspx page

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <telerik:RadWindowManager ID="Singleton" runat="server" Skin="Vista" EnableEmbeddedScripts="true">
            <Windows>
                <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="COBRAEvents.aspx"
                    OpenerElementID="Label1" Skin="Vista" Left="5" Top="1px" OnClientClose="OnClientclose"
                    ReloadOnShow="True" Style="display: none;" Behavior="Default" InitialBehavior="None"
                    Modal="True" VisibleStatusbar="False" Width="730px" Height="375px" ShowContentDuringLoad="False"
                    VisibleTitlebar="False">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
        <script type="text/javascript">
            function ShowAlert()

            {
               radalert("Data Saved Successfully",320,200,"Success");
            }
       </script>

I call the function ShowAlert() as follows
           string strSavesSuccessfully = "<script>Javascript:ShowAlert();</script>";
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "strSavesSuccessfully", strSavesSuccessfully);


Thank you
Maher


2 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 20 Feb 2009, 03:59 PM

Hi Maher AL-Rijleh,

The controls in the RadControls for ASP.NET AJAX suite are built upon the MS AJAX framework and the framework itself creates its controls (including RadWindowManager) in the Sys.Application.add_init() method.

Here is how the client events are fired in the page life cycle:

window.onload -> Sys.Application.init -> Sys.Application.load

You can see that the client object representation of MS AJAX controls are created just as the last code on the page in the Sys.Application.init event, which is raised after the window.onload event.

That is why when you call your code in window.onload by registering the client script, the RadWindowManager will still not be created on the page and you will get an error. To avoid this problem, you can either execute your code with a small timeout, or use the Sys.Application.add_load method in a manner similar to the one shown below:

protected void Button1_Click(object sender, EventArgs e)     
    {     
        string radalertscript = "<script language='javascript'> Sys.Application.add_load(function(){radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210);})</script>";     
        Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);     
    }    
 

You can find additional information about this below:

http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind-all-versions-of-radwindow.aspx

In case you need further assistance, please prepare a sample, fully runnable reproduction demo, open a new support ticket and send it to us along with detailed reproduction steps and explanations.


Best wishes,

Svetlina
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.
0
Maher
Top achievements
Rank 1
answered on 20 Feb 2009, 04:19 PM
WOW what a  remarkable and quick response. Your suggestion of changing my code worked great

Thank you
Maher
Tags
Window
Asked by
Maher
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Maher
Top achievements
Rank 1
Share this question
or