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

add_init function wasn't there before

8 Answers 113 Views
Menu
This is a migrated thread and some comments may be shown as answers.
SelAromDotNet
Top achievements
Rank 2
SelAromDotNet asked on 28 Aug 2008, 08:42 PM
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!

8 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 29 Aug 2008, 05:46 AM
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.
0
SelAromDotNet
Top achievements
Rank 2
answered on 29 Aug 2008, 01:37 PM
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?
0
Atanas Korchev
Telerik team
answered on 29 Aug 2008, 02:20 PM
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.
0
SelAromDotNet
Top achievements
Rank 2
answered on 11 Jun 2009, 04:55 PM
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!
0
Atanas Korchev
Telerik team
answered on 11 Jun 2009, 05:01 PM
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.
0
SelAromDotNet
Top achievements
Rank 2
answered on 11 Jun 2009, 05:02 PM
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 :(
0
Atanas Korchev
Telerik team
answered on 11 Jun 2009, 05:07 PM
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.
0
SelAromDotNet
Top achievements
Rank 2
answered on 11 Jun 2009, 05:10 PM
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!
Tags
Menu
Asked by
SelAromDotNet
Top achievements
Rank 2
Answers by
Erjan Gavalji
Telerik team
SelAromDotNet
Top achievements
Rank 2
Atanas Korchev
Telerik team
Share this question
or