使用内嵌资源

方法一:
   String pageScriptName = "Jump.Web.WebUI.FirstFocus";

    using (System.IO.StreamReader reader = new System.IO.StreamReader(typeof(FirstFocus).Assembly.GetManifestResourceStream(typeof(FirstFocus), "FirstFocusScript.js")))
    {
     String script = "<script language='javascript' type='text/javascript' >\r\n<!--\r\n" + reader.ReadToEnd() + "\r\n//-->\r\n</script>";
     this.Page.RegisterClientScriptBlock(pageScriptName, script);
    }


方法二:
   ResourceManager manager = new ResourceManager( this.GetType() );
   ResourceSet resources = manager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true);

   String script = resources.GetString("ClientScript");

你可能感兴趣的:(使用)