Add CSS, JS, and meta tags to the Asp.net background

Source: Internet
Author: User
# Region # Add a JS file // <summary> // Add a JS file // The Creator: porschev // Creation Time: 2011-7-25 /// </Summary> /// <Param name = "page"> page </param> /// <Param name = "url"> path </param> public void addscript (system. web. UI. page, string URL) {htmlgenericcontrol jscontrol = new htmlgenericcontrol ("script"); jscontrol. attributes. add ("type", "text/JavaScript"); jscontrol. attributes. add ("src", URL); page. header. controls. add (jscontrol) ;}# endregion # region ## Add a CSS file /// <summary> /// Add a CSS file /// created by posrchev /// creation time: 2011-7-25 /// </Summary> /// <Param name = "page"> page </param> /// <Param name = "url"> path </param> public void addcss (system. web. UI. page, string URL) {htmllink csscontrol = new htmllink (); csscontrol. href = URL; csscontrol. attributes. add ("rel", "stylesheet"); csscontrol. attributes. add ("type", "text/CSS"); page. header. controls. add (csscontrol) ;}# endregion # region ## add meta tag /// <summary> // Add meta tag /// created by: posrchev // Creation Time: 2011-7-25 /// </Summary> /// <Param name = "page"> page </param> /// <Param name = "name"> name </param> /// <Param name = "content"> body </param> Public void addmeta (system. web. UI. page, string name, string content) {system. web. UI. htmlcontrols. htmlmeta = new system. web. UI. htmlcontrols. htmlmeta (); Meta. name = Name; Meta. content = content; page. header. controls. add (Meta) ;}# endregion

Http://www.dtan.so

All three methods can be placed in the public class. If they are directly placed in the page class, the page parameter may not

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.