Showing posts with label GetElementById. Show all posts
Showing posts with label GetElementById. Show all posts

Saturday, February 23, 2008

Access ASP page from Silverlight 1.1 control

Say you want to alter the contents of an ASP page from within a Silverlight control on the page. To do so, get the HtmlDocument from HtmlPage and use GetElementById:


//This hides the div with id=contentId and displays the div with id=content2Id
HtmlDocument document = HtmlPage.Document;
document.GetElementByID("contentId").SetStyleAttribute("display", "none");
document.GetElementByID("content2Id").SetStyleAttribute("display", "block");