Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:06:24+00:00 2026-06-16T19:06:24+00:00

I have embedded a Silverlight application in my ASP.NET page and this Silverlight application

  • 0

I have embedded a Silverlight application in my ASP.NET page and this Silverlight application has two methods.

I want to call those methods through the ASPX page, i.e. my ASPX page has one Button control and when I click this button I want to call one of the Silverlight methods.

Is it possible? How would I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:06:25+00:00Added an answer on June 16, 2026 at 7:06 pm

    You can use Javascript to make a silverlight method calls.

    To permit user to access method of Silverlight from JavaScript, you have to set [ScriptableMember] attribute to that method.

    If you want to invoke those methods by ASPX methods/events, you should generate Javascript that invokes the silverlight methods.

    Example:

    Silverlight:

    ScriptableClass.cs

    public class ScriptableClass
        {
            [ScriptableMember]
            public void ShowAlertPopup(string message)
            {
                MessageBox.Show(message, "JS Message", MessageBoxButton.OK);
            }
        } 
    

    App.xaml.cs

     private void Application_Startup(object sender, StartupEventArgs e)
            {
                this.RootVisual = new MainPage();
                ScriptableClass myScript = new ScriptableClass();
                HtmlPage.RegisterScriptableObject("scriptableClass", myScript);
            } 
    

    index.html

     <script type="text/javascript">     
            var ctlSLHost = null;
            function onPluginLoaded(sender, args) {
                ctlSLHost = sender.getHost();
            }
    
            function InvokeSLMethod_ShowAlertPopup() {
                ctlSLHost.Content.scriptableClass.ShowAlertPopup
            ("Showing alert from JS in SL!");
            } 
        </script>
    
    <div>
            <div style="width: 250px; background: lightblue; font-weight: bold;height:30px">
                HTML Part
            </div>
            <div>
                <input type="button" value="Invoke SL Method - ShowAlertPopup" 
            onclick="InvokeSLMethod_ShowAlertPopup();" /></div>
        </div>
    
     <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                width="100%" height="80%">
                <param name="source" value="ClientBin/Silverlight2JSViseVersa.xap" />
                <param name="onError" value="onSilverlightError" />
                <param name="background" value="white" />
                <param name="minRuntimeVersion" value="4.0.50826.0" />
                <param name="autoUpgrade" value="true" />         
                <param name="onLoad" value="onPluginLoaded" />
    
                <a href=http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0 
            style="text-decoration: none">
                    <img src=http://go.microsoft.com/fwlink/?LinkId=161376 
            alt="Get Microsoft Silverlight"
                        style="border-style: none" />
                </a>
            </object> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have an ASP.NET MVC web application that has a silverlight application embedded
I have an application that is built using ASP.NET, with an embedded Silverlight Object
I have this existing environment: 1) ASP.NET 3.5 web application 2) forms authentication with
I have a Silverlight 4 application which is hosted in asp.net website as ClientBin
I have Silverlight class embedded into page, in App.xaml.cs this component registered to allow
I have created a web application with a Silverlight project embedded in it, using
I have embedded an IronPython engine in a C# application. I want to expose
I'm working on a Silverlight 4 application. I have a TM symbol embedded in
I have a Silverlight 4 application that I am running embedded on a web
I have a web page with some embedded Silverlight. In that Silverlight I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.