RadColor picker object is null

2 posts, 0 answers
  1. Mariyam Khambhati
    Mariyam Khambhati avatar
    20 posts
    Member since:
    Apr 2008

    Posted 12 Jan 2009 Link to this post


    I am able to obtain the RadcolorPicker object on in the following case:

    serverside code(aspx.cs)

                    protected void Page_Load(object sender, EventArgs e)
                dropdownList1.Attributes.Add("onchange", "javascript:clddIndicesList_onchange();");

    Clientside code:(aspx)

             function clddIndicesList_onchange()

    but RadColorPicker object will be 'null' in the following cases
    1) <body onload="clddIndicesList_onchange()">

    2) End of the aspx page <script language="javascript" type="text/javascript">clddIndicesList_onchange();</script>

    Please let me know the solution for this?

  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 13 Jan 2009 Link to this post

    Hi Mariyam,

    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 RadColorPicker) 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 RadColorPicker 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.

    Sincerely yours,

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
Back to Top