How to set the content from code behind
The RadHtmlPlaceholer is declared on page this way:
<UserControl x:Class="RadHtmlPlaceholderDemo.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Width="700" Height="480"
>
<Grid x:Name="LayoutRoot" Background="White">
<Border BorderBrush="Black" BorderThickness="1">
<telerik:RadHtmlPlaceholder x:Name="RadHtmlPlaceholder1"/>
<Button Content="Set Content" Click="Button_Click" />
</Border>
</Grid>
</UserControl>
To set external URL use the following code:
private void Button_Click(object sender, RoutedEventArgs e)
{
RadHtmlPlaceholder1.SourceUrl = new Uri("http://www.bing.com");
}
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
RadHtmlPlaceholder1.SourceUrl = New Uri("http://www.bing.com")
End Sub
To set HTML string as a content use the following code:
private void Button_Click(object sender, RoutedEventArgs e)
{
RadHtmlPlaceholder1.HtmlSource = @"<b>Hello World.</b>";
}
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
RadHtmlPlaceholder1.HtmlSource = "<b>Hello World.</b>"
End Sub