In my cases, I would like to insert the css and js file into the dll for this, I follow the steps below and it works.
step 1 Place the following code on top of your page behind
[assembly:WebResource("YourProjectName.Assets.Plugins.Dropzone.dist.dropzone.js", "application/x-javascript")] [assembly:WebResource("YourProjectName.Assets.Plugins.Dropzone.dist.dropzone.css","text/css")] namespace Sanay.Suip.UserControls { public partial class FileUpload : UserControlBase {
Step 2
And in the inInitial case below.
`protected override void OnInit(EventArgs e) { base.OnInit(e); string css = "<link href=\"" + Page.ClientScript.GetWebResourceUrl(this.GetType(), "YourProjectName.Assets.Plugins.Dropzone.dist.dropzone.css") + "\" type=\"text/css\" rel=\"stylesheet\" />"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "cssFile", css, false); ClientScriptManager csm = Page.ClientScript; csm.RegisterClientScriptResource(GetType(), "YourProjectName.Assets.Plugins.Dropzone.dist.dropzone.js"); }
`
Ali Sadri
source share