add_init function wasn't there before

9 posts, 0 answers
  1. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 28 Aug 2008 Link to this post

    I'm in the process of upgrading my controls to the newest release, but I noticed on my menu at the bottom of the page there is a Sys.Application.add_init function that wasn't there before, and it seems to be iterating through all the navigation items again! it has already rendered them to the page so why does it add all that stuff at the bottom again?

    thanks!
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 29 Aug 2008 Link to this post

    Hi SelArom,

    The add_init call is actually adding an event handler to the init event of the ASP.NET Ajax page. The event handler makes a $create call to create the ASP.NET Ajax component and initialize it. These are standard ASP.NET Ajax operations. The $create function binds the data of the ASP.NET Ajax object to its DOM representation (which is rendered).

    The $create call was introduced in RadControls for ASP.NET Ajax, while RadControls for ASP.NET "Classic" use a different type of JavaScript object creation and initialization.

    I hope this helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 29 Aug 2008 Link to this post

    thank you for your helpful reply! however, it is really necessary to do this? I'm not doing any ajax stuff or anything fancy with the menu... it seems like a lot of code to just render it... can this be optimized any further or even removed?
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 29 Aug 2008 Link to this post

    Hi SelArom,

    No, this call is vital for the proper initialization of RadMenu.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 11 Jun 2009 Link to this post

    okay, a lot of time has passed since I posted this thread, however I've encountered a problem that may be related...

    I have a radtreeview which I'm using to create a sidebar navigation control, however, I have no need for the skin, or embedded scripts, as I'm only using this as a static menu. as a result, I set enableembeddedscripts to false...

    however, the page is still adding and calling the create method for the radtreeview! since I disabled the scripts, it's not rendering the webresource.axd that contains this definition, and therefore I get the error "Telerik is not defined"

    I seem to be able to confirm this theory because if I set enableembeddedscripts to true, the error no longer appears.

    Please let me know if if there is something else I need to change in the control properties to correct this situation.

    thank you!
  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 11 Jun 2009 Link to this post

    Hi SelArom,

    This behavior cannot be avoided since RadTreeView is ASP.NET Ajax control and always registers with a script manager. The script manager in turn renders the add_init statement. I am afraid you cannot use RadTreeView without including its JavaScript files.

    All the best,
    Albert
    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.
  8. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 11 Jun 2009 Link to this post

    is this an oversight then? because if the control requires the scripts, then there should not be a property allowing you to disable them...

    looks like I'll have to code my sidebar manually :(
  9. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 11 Jun 2009 Link to this post

    Hi SelArom,

    The EnableEmbeddedScripts property exists so users can disable automatic script registration. However all telerik controls rely on JavaScript in order to work so the required files must be included manually. This is described in detail in this help topic.

    Regards,
    Albert
    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.
  10. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 11 Jun 2009 Link to this post

    wait no I'm not saying that I've disabled Javascript entirely on my page, what I am saying is that I do not need the ajax scripts that go with the control, exactly as you've described.

    but it looks like the article you've linked is exactly what I was looking for, thank you! I assume since I've included my own jquery reference, I only need to inlcude the treeview script?

    i'll play with it, thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017