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 937645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:30:41+00:00 2026-05-15T21:30:41+00:00

I have a Silverlight application with some maps, and in the same page this

  • 0

I have a Silverlight application with some maps, and in the same page this application is running, I have a table that describe the values related to the map. I want to create a way that when I put the mouse over some icon in the map, the row with the correspondent ID get highlighted. Is that even possible? I’m using simple asp tables, on ASP MVC.

Following AnthonyWJones’s instructions, I made this:

Silverlight

        private void MapClick(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 4; i++)
            {
                System.Windows.Controls.Primitives.ButtonBase button = (System.Windows.Controls.Primitives.ButtonBase)VisualTreeHelper.GetChild(RegionCanvas, i);
                if (button.IsPressed)
                    HtmlPage.Window.Invoke("highlightRow",(int)button.DataContext);



            }
        }

aspx

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">
    function highlightRow(id) {
        id = "porto" + id;
        document.getElementById(id).setAttribute("bgColor", "#123456");
    }
</script>


<%try{ %>
         <h2><%:(String) Model.FirstOrDefault().estado%></h2>   
          <%} %>
    <%catch (Exception e) { }%>


   <table id="tblLayout">
   <tr>
   <td><div style="height:300px"> 

        <object data="data:application/x-silverlight-2," 
            type="application/x-silverlight-2" height="300px" style="width: 400px">


          <param name="source" value="/ClientBin/MiniSIG.xap"/>

          <param name="onError" value="onSilverlightError" />
          <param name="background" value="white" />
          <param name="minRuntimeVersion" value="3.0.40818.0" />
          <%try{ %>
            <param name="initParams" value="startPage=<%:(String) Model.FirstOrDefault().estado%>" />
          <%} %>

          <%catch (Exception e) { }%>


          <%finally{
                if(Model.FirstOrDefault() == null){%>
            <param name="initParams" value="startPage=main" /> 
          <%} }%>
          <param name="autoUpgrade" value="true" />
          <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
              <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </a>
        </object>

    </div> </td>
   <td><table>
        <tr>
            <th>
                ID do Porto
            </th>
            <th>
                Nome
            </th>

            <th>
            Cidade
            </th>
            <th>
                ID da Cidade
            </th>
            <th>
                Tipo
            </th>
        </tr>

    <% foreach (var item in Model) { %>

        <tr id="porto<%: item.idporto %>">

            <td>
                <%: item.idporto %>
            </td>
            <td>
                <%: Html.ActionLink(item.nome, "../Portos/Details/"+item.idporto)%>
            </td>

            <td>
                <%: item.municipio %>
            </td>
            <td><%: item.idcidade %></td>
            <td>
                <%: item.tipo %>
            </td>
        </tr>

    <% } %>

    </table></td>
   </tr>

    </table>

    <p>
        <%: Html.ActionLink("Voltar", "Index") %>
    </p>

</asp:Content>

Can you tell me if I’m doing something wrong? I tried to run it, but it didn’t work.

  • 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-05-15T21:30:41+00:00Added an answer on May 15, 2026 at 9:30 pm

    There are a couple of ways to do this. The easiest would be to simply use HtmlPage.Window :-

    HtmlPage.Window.Invoke("someJSFuncName", myID);
    

    The containing page can contain a the Javascript:-

    function someJSFuncName(theID)
    {
        // Do Stuff with theID
    
    }
    

    Of course this creates a tight coupling between the Silverlight app and the page that may not be desirable. The other option is more complex using HtmlPage.RegisterScriptableObject. Its quite messy so I would only recommend it if you really need to de-couple the XAP from the host page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.