There was a need to obtain values from the ASP.NET page to Silverlight application.
This is the function that can get the value.
private string
GetHtmlElementValue(string
htmlElementId)
{string togoElementValue = "";
HtmlDocument doc = HtmlPage.Document;
if (doc == null)
{
MessageBox.Show("Html Document is null.","Error", MessageBoxButton.OK);
return togoElementValue;
}
HtmlElement elm = doc.GetElementById(htmlElementId);
if (elm == null)
{
MessageBox.Show("Html Element " + htmlElementId + " is null.", "Error", MessageBoxButton.OK);
return togoElementValue;
}
togoElementValue = elm.GetAttribute("value");
return togoElementValue;
}
This is how the function should be called.
GetHtmlElementValue("AuthenticationTypeField");
This will come in handy when we need to pass the information from ASP.NET page to Silverlight Application.
Hope this helps.
Cheers
Adam
No comments:
Post a Comment