How to add custom CSS in your WebPart

If you want to add custom CSS file for your webpart, here is the code:

  1. protected override void CreateChildControls()
  2. {
  3. base.CreateChildControls();
  4. CssLink cssLink = new CssLink();
  5. cssLink.DefaultUrl = “/_layouts/Test.css”;
  6. this.Page.Header.Controls.Add(cssLink);
  7. }
Share
Share via
Copy link
Powered by Social Snap