ScriptReference::Name Property

 

Gets or sets the name of the embedded resource that contains the client script file.

Namespace:   System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public:
property String^ Name {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The name of the client script file that is embedded as a resource in an assembly.

You set the Name property to reference a client script file that is embedded as a resource in an assembly.

If you define values for both the Path and Name properties in the same script reference, the Path property takes precedence.

The following example shows how to reference a custom control and a JavaScript file that is embedded in the control assembly. The assembly is assumed to be in the Bin folder of the Web site. The custom control animates UpdatePanel controls. The JavaScript file is compiled as an embedded resource that is named SampleControl.UpdatePanelAnimation.js. You register the embedded JavaScript file by using the Assembly and Name properties.

To use this example, compile the JavaScript file that is shown in the example as an embedded resource with the custom control. Put the resulting assembly into the Bin folder of the Web site. For an example of how to embed a JavaScript file in an assembly, see Walkthrough: Embedding a JavaScript File as a Resource in an Assembly.

The following example shows a page that uses the custom control.

No code example is currently available or this language may not be supported.

The following example shows the custom control class definition.

No code example is currently available or this language may not be supported.

The following example shows the supporting JavaScript file.

BorderAnimation = function(color) {
    this._color = color;
}

BorderAnimation.prototype = {
    animate: function(panelElement) {
        var s = panelElement.style;
        s.borderWidth = '2px';
        s.borderColor = this._color;
        s.borderStyle = 'solid';

        window.setTimeout(
            function() {{
                s.borderWidth = 0;
            }},
            500);
    }
}

The following example shows code that you must add to the AssemblyInfo file of the project that contains the custom control and the JavaScript file.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show: