摘要:Create User Control in dll - Check List
MyUserControl.ascx
Build Action = Embedded Resource
MyUserControl.vb
Build Action = Compile
If want to use resource in dll.
eg: Style.css (can place in root or under css folder.)
Build Action = Embedded Resource
Add a line in AssemblyInfo.vb (LSLIBWebBased is your Assembly name and Root namespace.)
<Assembly: System.Web.UI.WebResource("LSLIBWebBased.Style.css", "text/css")>
Add code in MyUserControl.vb
Dim lsCSSUrl As String = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "LSLIBWebBased.Style.css")
Dim lLiteralControl As New LiteralControl("
")
DirectCast(Page.Header, HtmlControls.HtmlHead).Controls.Add(lLiteralControl)
eg: test.gif (can place in root or under img folder.)
Build Action = Embedded Resource
Add code in MyUserControl.ascx
<asp:Image ID="imgtest" runat="server" />
Add code in MyUserControl.vb
imgtest.ImageUrl = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "LSLIBWebBased.test.gif")
------------------
熱愛生命 喜愛新奇 有趣的事物
過去 是無法改變
將來 卻能夠創造
希望使大家生活更便利
世界更美好
a guy who loves IT and life