Thank you,
Andrew
6 Answers, 1 is accepted
Html placeholder will show the XML file the way the browser is displaying it. It do not have any functionality to deal with XML, other than that. Just point the SourceUrl property to the XML file.
Sincerely yours,
Valentin.Stoychev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you,
Andrew
You can parse the XML and convert it to HTML and then to pass it to the HtmlPlaceholder. See here how to display html string with the HtmlPlaceholder in Silverlight:
http://www.telerik.com/help/silverlight/radhtmlplaceholder-howto-displayhtml.html
Kind regards,
Valentin.Stoychev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Unfortunately it will not be the same as if I had SourceUrl initialized with the path to valid XML file. In the later case HtmlPlaceholder uses underlying browser to display XML content and that automatically creates colors indents, etc.. Also XML document in this case is "interactive" because its XML elements and nodes can be collapsed/expanded (this what IE and some other browsers do with external XML documents by default). By using my own custom formatting of XML string as HTML document I will not get this "interactivity".
Why wouldn't you had HTMLPlaceholder property like Content-Type that by default is text/html and if it is text/xml it will interpret HtmlSource value as XML but not HTML and act on it accordingly. At the end of the day all we need is to let underlying browser to act on XML document the way it already can, we just need this functionality to be exposed through HTMLPlaceholder control.
Thanks,
Andrew
Basically we are using an iframe for external content and we dont have the option to change the content type.
Another option for you which will not require the parsing would be to save the XML content by using a service on the server, and then to direct the HtmlPlaceholder to the saved url ( e.g. to the XML file). This is not very good from performance point of view, but it all depends from your application requirements.
Sincerely yours,
Valentin.Stoychev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Dim MessageDetails As New RadHtmlPlaceholder |
Dim TmpString As String |
AuditGridRow = TryCast(Me.AuditsGrid.SelectedItem, tblMessageAudit) |
radPane2.Header = Left(e.NewCell.Content.ToString, 8) & "..." |
TmpString = AuditGridRow.XMLMessage.ToString |
TmpString = TmpString.Replace("<", "<") |
TmpString = TmpString.Replace("> ", "~~~~") ' handle this afterwards |
TmpString = TmpString.Replace(">", ">") ' the > that don't have a space after them |
TmpString = TmpString.Replace("~~~~", "><br/>") ' so they have newlines in the HTML |
TmpString = TmpString.Replace(" ", "  ") |
TmpString = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='Content-Type' /><title>XML Message</title></head><body><div style='font-family: 'Courier New', Courier, monospace; font-size: x-small; width:100%;' >" & TmpString |
TmpString = TmpString & "</div></body></html>" |
MessageDetails.HtmlSource = TmpString |
- it gets the job done and the output looks OK, except for the font
- everyone who sees the code knows immediately what it is doing
- it is fast
- it will never win me any award for 'sophisticated programmer of the year' :-) but I didn't see anyone step up with anything better either :-)