This is a mirror of official site: http://jasper-net.blogspot.com/

How to Access/Manipulate HTML Elements/Javascript in Silverlight

| Wednesday, February 9, 2011
Introduction:

Interacting between HTML and ASP.NET has been one of the most common coding scenarios we have come across; i.e. accessing HTMLl elements and calling JavaScript from code behind. I recently came across a situation where I wanted to add Silverlight content to an existing page and allow the HTML and Silverlight portions of the page to interact.

When we need this interaction: So let us see initially what could be probable scenarios where we need to interact / access HTML in Silverlight page.

  1. To make compatible: When we want to use the latest and greatest user interfaces with Silverlight, this requires compatibility with HTML. Situations could be like including a Silverlight content region to show non-essential extras alongside the critical HTML content.
  2. Legacy web pages: If we have an existing web page that does exactly what we want, it may make more sense to extend it with a bit of Silverlight pizzazz than to replace it outright. So the solution is to create a page that includes both HTML and Silverlight content.
  3. Server-side features: We know that Silverlight is a poor fit for tasks that need to access server resources or require high security, which is why it makes far more sense to build a secure checkout process with a server-side programming framework like ASP.NET. But you can still use Silverlight to display advertisements, video content, product visualizations, and other value-added features in the same pages.

So, let's try to BRIDGE this gap between Silverlight and the ordinary world of HTML.

What is this BRIDGE: This BRIDGE is built using a Silverlight set of managed classes (commonly called Helper classes) that replicate the HTML DOM (document object model), and we can access these classes by namespace, System.Window.Browser.

silver1.gif

Read more: C# Corner

Posted via email from Jasper-net

0 comments: