IncludeScript.cs 677 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web.UI.HtmlControls;
  6. using Bowin.Common.Utility;
  7. namespace Bowin.Common
  8. {
  9. public class IncludeScript
  10. {
  11. public static void Include(IEnumerable<string> scriptsPath, HtmlHead head)
  12. {
  13. HtmlGenericControl js;
  14. scriptsPath.ForEach((item, index) =>
  15. {
  16. js = new HtmlGenericControl("script");
  17. js.Attributes.Add("type", "text/javascript");
  18. js.Attributes.Add("src", head.ResolveClientUrl(item));
  19. head.Controls.AddAt(index, js);
  20. });
  21. }
  22. }
  23. }