- Try n keep all js external.
- Don’t assign methods in html “<a href=’doSomething’…”. Instead, render clean html and bind events to it using jquery (or any library) “selectors” and “for/each” methods. Alternatively you may also render a javascript array of “ids” to bind the function to.
- Use JSON Serialization. Avoid manually constructing javascript arrays/objects using StringBuilder in code behind as it is tedious and unnecessary effort.
- Lazy load contents. Reduce page load by lazy loading extra static content. Extra content can be the html which is “displayed-none” by default on your pages.
- Put Js calls in the end. Move all “<script src=….>” to the end of your html –right before ending body tag. Even better if you can lazy load your scripts to reduce initial page load.
Tuesday, September 28, 2010
Asp.net and Javascript- Useful tips -2
More on asp.net and Javascript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment