Recommendation: Conventions for executing javascript functions

Executions per action

You should not add more than 2 javascript function executions per action (besides globally executed javascript functions e.g. by MVC-filters). One for the PageLoadEvent.Ready and one for the PageLoadEvent.Init.
This way developers don't loose track of the executed functions.

Naming of javascript functions

You should name your javascript functions which are executed by the code behind in a consistent way.
E.g. you could name your function which is executed at the PageLoadEvent.Ready "SomeLiteral.Ready" and your function for the PageLoadEvent.Init-event "SomeLiteral.Init".
This way developers directly see that and when this function is called by code behind.

Last edited Jan 7, 2013 at 12:49 PM by acuntex, version 1


No comments yet.