Handling HTML Events in .Net code

From the channel nine screen cast Silverlight - Handling HTML Events in .NET Code by Mike Taulty
 
Void OnLoaded (object sender, RoutedEventArgs e)
{
    HtmlElement element =
        HtmlPage.Document.GetElementById("MyButton");
    element.AttachEvent("onclick", (EventHandler)MyHandler);
}
void MyHandler( object sender, EventArgs args)
{
    //Do something.
}
Comments [0]
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview