Silverlight.OnPluginError Property
Gets or sets the name of the client JavaScript function (event handler) that is called if a run-time error occurs with the Silverlight plug-in.
Namespace: System.Web.UI.SilverlightControls
Assembly: System.Web.Silverlight (in System.Web.Silverlight.dll)
Syntax
'Declaration
<BindableAttribute(True)> _
Public Overridable Property OnPluginError As String
Get
Set
'Usage
Dim instance As Silverlight
Dim value As String
value = instance.OnPluginError
instance.OnPluginError = value
[BindableAttribute(true)]
public virtual string OnPluginError { get; set; }
Property Value
Type: System.String
The name of the JavaScript function that is called if an error occurs in the Silverlight plug-in.
Remarks
The Sys.UI.Silverlight.Control.pluginError event client occurs at runtime when an error occurs in the plug-in.
Examples
The following example shows client script that is called when an error occurs in the Silverlight plug-in at runtime. This code example is part of a larger example provided for the MediaPlayer server control.
The errorArgs parameter is a client Sys.UI.Silverlight.ErrorEventArgs type.
function OnPluginErrorHandler(sender, errorArgs)
{
var errorMsg = "Silverlight Plugin Error: \n\n";
GeneralErrorHandler(sender,errorArgs,errorMsg);
}
function OnMediaFailedHandler(sender, errorArgs)
{
var errorMsg = "Silverlight Media Error: \n\n";
GeneralErrorHandler(sender,errorArgs,errorMsg);
}
function GeneralErrorHandler(sender, errorArgs, errorMsg)
{
// Error information common to all errors.
errorMsg += "Error Type: " + errorArgs.get_error().errorType + "\n";
errorMsg += "Error Message: " + errorArgs.get_error().errorMessage + "\n";
errorMsg += "Error Code: " + errorArgs.get_error().errorCode + "\n";
// Display the error message.
alert(errorMsg);
}
function OnPluginErrorHandler(sender, errorArgs)
{
var errorMsg = "Silverlight Plugin Error: \n\n";
GeneralErrorHandler(sender,errorArgs,errorMsg);
}
function OnMediaFailedHandler(sender, errorArgs)
{
var errorMsg = "Silverlight Media Error: \n\n";
GeneralErrorHandler(sender,errorArgs,errorMsg);
}
function GeneralErrorHandler(sender, errorArgs, errorMsg)
{
// Error information common to all errors.
errorMsg += "Error Type: " + errorArgs.get_error().errorType + "\n";
errorMsg += "Error Message: " + errorArgs.get_error().errorMessage + "\n";
errorMsg += "Error Code: " + errorArgs.get_error().errorCode + "\n";
// Display the error message.
alert(errorMsg);
}
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also
Reference
System.Web.UI.SilverlightControls Namespace
OnPluginError