Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is this server control or .Ascx Server control? If it is a server control, what type of control does it inherit from? If you inherit from a WebControl, you can do something like this (this is an abbreviated example, so will require some work on your side):</p> <pre><code>Public Class myControl Inherits WebControl Private Sub attachWebResources() Dim styleLink As String = "&lt;link rel='stylesheet' text='text/css' href='{0}' /&gt;" Dim location As String = Page.ClientScript.GetWebResourceUrl(Me.[GetType](), "myApp.WebControls.myStyles.css") Dim styleInclude As New LiteralControl([String].Format(styleLink, location)) DirectCast(Page.Header, HtmlControls.HtmlHead).Controls.Add(styleInclude) ScriptManager.RegisterClientScriptResource(Me, Me.GetType, "myApp.WebControls.jquery-1.4.1.min.js") EnsureChildControls() End Sub Protected Overrides Sub OnInit(ByVal e As System.EventArgs) attachWebResources() MyBase.OnInit(e) End Sub End Class </code></pre> <p>This example shows how to included an embedded CSS and JS file in your control. You will need to include the JS and CSS file in your Web Control Library project. You will then need to add a reference for your JS file in your AssemblyInfo.Vb file, like this:</p> <pre><code>&lt;Assembly: Web.UI.WebResource("myApp.WebControls.jquery-1.4.1.min.js", "text/javascript")&gt; </code></pre> <p>If this is an ASCX web control, or any kind of server control, you can add the code like this:</p> <pre><code> Dim myScript As New StringBuilder myScript.Append("function helloWorld(){" &amp; vbCrLf) myScript.Append("alert('hello world')" &amp; vbCrLf) myScript.Append("}" &amp; vbCrLf) Page.ClientScript.RegisterStartupScript(Me.GetType(), "myKey", myScript.tostring, True) </code></pre> <p>Either way, if you have more questions let me know which type you are using and post the relevant code that you have added so far.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload