The problem that I'm encountering is the xhtml that I'm passing in to the telerik RadRichTextBox is being modified by removing parts of the <a> anchor tag. Specifically, the href and a custom property (not shown in my example). I've include the xhtml that I send into the editor and what I get out from the editor. The links in the editor do not work so I know that the link tag is being stripped when I set the xhtml to the document.
Here is the Get/Set that I use.
xhmtl from the first Trace output (href="http://www.google.com" is there)
<!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>
<title></title>
</head>
<body style="FONT-SIZE: 14pt; FONT-FAMILY: Terminal; COLOR: #000000; DIRECTION: ltr">
<span style="FONT-SIZE: 14pt; FONT-FAMILY: Terminal"> </span>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a id="BC3BE1011F754A44B7BE22BA0208FB21" name="BC3BE1011F754A44B7BE22BA0208FB21" href="http://www.google.com" style="cursor:pointer;">test link to google</a>fdsa
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a name="98E8EC0711AA4508BDAE5A97A4FDA86F" href="http://www.google.com" style="cursor:pointer;">test link to google</a>
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a name="3C42D11201D24B7E8848383B02A7F119" href="http://www.google.com" style="cursor:pointer;">test link to google</a>
</p>
</body>
</html>
xhtml out of the editor, the href is missing
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled</title><style type="text/css">
p { margin-top: 0px;margin-bottom: 0px;line-height: 1.15; }
body { font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px; }
.Normal { telerik-style-type: paragraph;telerik-style-name: Normal;border-collapse: collapse; }
.TableNormal { telerik-style-type: table;telerik-style-name: TableNormal;border-collapse: collapse; }
.NormalWeb { telerik-style-type: paragraph;telerik-style-name: NormalWeb;margin-top: 6.66px;margin-bottom: 6.66px;border-collapse: collapse; }
.s_9397EFD2 { telerik-style-type: local;font-family: 'Arial';font-size: 18.6666666666667px;color: #000000; }
.p_C499D8E6 { telerik-style-type: local;margin-top: 0px;margin-bottom: 0px; }
.s_24B402CC { telerik-style-type: local;font-family: 'Arial';font-size: 18.6666666666667px;color: #0000FF; } </style></head><body><p class="NormalWeb "><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="BC3BE1011F754A44B7BE22BA0208FB21"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2">fdsa </span></p><p class="NormalWeb p_C499D8E6"><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="98E8EC0711AA4508BDAE5A97A4FDA86F"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="3C42D11201D24B7E8848383B02A7F119"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2"> </span></p></body></html>
Here is the Get/Set that I use.
public
string
HtmlText
{
get
{
string
xhtml =
new
HtmlFormatProvider().Export(Document);
return
xhtml;
}
set
{
Trace.WriteLine(xhtml);
Document =
new
HtmlFormatProvider().Import(xhtml);
Trace.WriteLine(
new
HtmlFormatProvider().Export(Document));
}
}
xhmtl from the first Trace output (href="http://www.google.com" is there)
<!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>
<title></title>
</head>
<body style="FONT-SIZE: 14pt; FONT-FAMILY: Terminal; COLOR: #000000; DIRECTION: ltr">
<span style="FONT-SIZE: 14pt; FONT-FAMILY: Terminal"> </span>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a id="BC3BE1011F754A44B7BE22BA0208FB21" name="BC3BE1011F754A44B7BE22BA0208FB21" href="http://www.google.com" style="cursor:pointer;">test link to google</a>fdsa
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a name="98E8EC0711AA4508BDAE5A97A4FDA86F" href="http://www.google.com" style="cursor:pointer;">test link to google</a>
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
</p>
<p style="MARGIN-BOTTOM: 0px; DIRECTION: ltr; MARGIN-TOP: 0px">
<a name="3C42D11201D24B7E8848383B02A7F119" href="http://www.google.com" style="cursor:pointer;">test link to google</a>
</p>
</body>
</html>
xhtml out of the editor, the href is missing
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled</title><style type="text/css">
p { margin-top: 0px;margin-bottom: 0px;line-height: 1.15; }
body { font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px; }
.Normal { telerik-style-type: paragraph;telerik-style-name: Normal;border-collapse: collapse; }
.TableNormal { telerik-style-type: table;telerik-style-name: TableNormal;border-collapse: collapse; }
.NormalWeb { telerik-style-type: paragraph;telerik-style-name: NormalWeb;margin-top: 6.66px;margin-bottom: 6.66px;border-collapse: collapse; }
.s_9397EFD2 { telerik-style-type: local;font-family: 'Arial';font-size: 18.6666666666667px;color: #000000; }
.p_C499D8E6 { telerik-style-type: local;margin-top: 0px;margin-bottom: 0px; }
.s_24B402CC { telerik-style-type: local;font-family: 'Arial';font-size: 18.6666666666667px;color: #0000FF; } </style></head><body><p class="NormalWeb "><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="BC3BE1011F754A44B7BE22BA0208FB21"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2">fdsa </span></p><p class="NormalWeb p_C499D8E6"><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="98E8EC0711AA4508BDAE5A97A4FDA86F"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><span class="s_9397EFD2"> </span></p><p class="NormalWeb p_C499D8E6"><a name="3C42D11201D24B7E8848383B02A7F119"><span class="s_24B402CC">test link to google</span></a><span class="s_9397EFD2"> </span></p></body></html>