1

It seems to me that I could use ECMAScript from within a user control or a visual web part, but which is the more efficient in terms of resource use, speed etc?

  • I'm not quite sure what you are asking? If executing javascript is faster from a webpart or a user control? – Robert Lindgren Oct 4 '13 at 12:09
1

User controls must be compiled before use, which adds to the load time while WebParts are precompiled ones and are faster.

But you may use delegate control which resides in the AdditionalPageHead control on the page. It will register some ECMAScript (JavaScript, JScript) on the page.

  • Visual Web Parts compile user controls in runtime as well, don't they? – Tim Oct 4 '13 at 12:40
  • Depends on the Visual Web Part template you're using. The one in Visual Studio 2012 doesn't really include a user control so there is no dynamic compilation. I have a video on YouTube that explains this in detail: youtube.com/watch?v=xjgebK7njbo – Rob Windsor Oct 4 '13 at 15:13
  • Though, the 2010 Visual Web Part had a slight performance hit due to loading of the user control and the slight increase in complexity due to addition of user control components to the Web Part and the interaction between them. – Falak Mahmood Oct 4 '13 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.