When is toolbar object created.

2 posts, 0 answers
  1. Tony Steele
    Tony Steele avatar
    16 posts
    Member since:
    Aug 2003

    Posted 05 Apr 2008 Link to this post

    I have just converted one of my toolbars from RadControls Asp.Net to the New ToolBar in the 2008.1 Futures.

    A the end of the page, after the </form> I kick of a number of ajax requests(using a light weight framework), those callbacks update the status of the tool bar buttons.

    This worked fine in the old version, however with the new version it appears the javascript toolbar object is created a long after the toolbar is displayed. I use $find as late as possible to get the toolbar object (within the ajax callback) . However it does not appear to exist until well after the toolbar has displayed.

    So when I call $find a null is returned.

    I can see the following in the code :

    Sys.Application.add_init(function() {
        $create(Telerik.Web.UI.RadToolBar, {"_skin":"Office2007","attributes":{},"clientStateFieldID":"ctl00_ContentPlaceHolder_CTb_ClientState","collapseAnimation":"{\"type\":12,\"duration\":200}","itemData":[{"value":"Insert","commandName":"Insert","toolTip":"Insert Item","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/insert.gif"},{"value":"Cancel","commandName":"Cancel","toolTip":"Cancel current Operation","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/cancel.gif"},{"value":"Back","commandName":"Back","toolTip":"Return to previous Operation","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/return.gif"},{"value":"Print","commandName":"Print","toolTip":"Print contents","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/print.gif"},{"value":"Config","commandName":"Config","toolTip":"Edit Configuration","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/option.gif"},{"value":"Export","commandName":"Export","toolTip":"Export Items","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/excel.gif"},{"value":"Import","commandName":"Import","toolTip":"Import Items","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/excel.gif"},{"value":"Admin","commandName":"Admin","toolTip":"Administration","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/admin.gif"},{"value":"Tool","commandName":"Tool","toolTip":"Run Tool","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/cog.gif"},{"value":"Map","commandName":"Map","toolTip":"View Map","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/map.gif"},{"value":"List","commandName":"List","toolTip":"View List","cssClass":" rtbWrap","imageUrl":"http://206.196.22.102/resource/toolbar/list.gif"}]}, {"buttonClicked":contentTBClickHandler}, null, $get("ctl00_ContentPlaceHolder_CTb"));
    });

    Which is before the code where I triggered the Ajax requests, I assume since its being added to an initialization function that the toolbar is created at some latter stage.

    What is the best approach here, Does this mean I should put my code in a a delegate function attached to the 
    Sys.Application.add_load event.






  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 07 Apr 2008 Link to this post

    Hi Tony,

    Indeed, you should use either the pageLoad function or a handler, added to the load event of the Sys.Application object.

    This is due to the fact that the client-side part of a control based on ASP.NET Ajax is created in the Sys.Application object's init event.

    I hope this helps.

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