Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Custom" ScriptManager control?
    primarykey
    data
    text
    <p>I'm looking to build a control that essentially abstracts a ScriptManager. I need it to look/feel just like as close to a regular ScriptManager as possible. The reason for this is so we can use an "#if not DEBUG" statement to dynamically load the .js files in CompositeScript for release, but also maintain easy debugging in our dev environment.</p> <p>Here is what I've been playing with so far(The control markup contains nothing but an empty ScriptManagerProxy):</p> <pre><code>Public Partial Class MyScriptManager Inherits System.Web.UI.UserControl Dim mlScripts As New List(Of ScriptReference) Dim mlServices As New List(Of ServiceReference) </code></pre> <h1>Region "Properties"</h1> <pre><code>Public Property Scripts() As List(Of ScriptReference) Get Return mlScripts End Get Set(ByVal value As List(Of ScriptReference)) mlScripts = value End Set End Property Public Property Services() As List(Of ServiceReference) Get Return mlServices End Get Set(ByVal value As List(Of ServiceReference)) mlServices = value End Set End Property </code></pre> <h1>End Region</h1> <pre><code>Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init #If DEBUG Then LoadNonComposite() #Else LoadComposite() #End If For Each scr As ServiceReference In mlServices smScriptManagerProxy1.Services.Add(scr) Next End Sub </code></pre> <h1>Region "Helper Methods"</h1> <pre><code>Private Sub LoadComposite() For Each sr As ScriptReference In mlScripts smScriptManagerProxy1.CompositeScript.Scripts.Add(sr) Next End Sub Private Sub LoadNonComposite() For Each sr As ScriptReference In mlScripts smScriptManagerProxy1.Scripts.Add(sr) Next End Sub </code></pre> <h1>End Region</h1> <p>End Class</p> <p>It appears that the ScriptReferences are not getting registered correctly. In DEBUG, I get errors about multiple scripts being loaded, and in RELEASE, I get "sys not defined"(Ajax library not being loaded). We use ScriptReferenceProfiler to get all the .js being loaded and add it manually(aka, "MicrosoftAjax.js" is manually added to the ScriptManager in markup)</p> <p>Any help/direction is appreciated!</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. 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