アプリケーションの HTML テキストに問題があります。シナリオは、エディター (私の場合は reditor) に入力されたテキストを xml 属性に保存できるということです。保存している間、私は好きです、
Server.HtmlEncode(EditorGuidance.Content.Trim)
私のコードの他の部分では、onclick javascript イベントが添付されたコード ビハインドから画像を作成し、このガイダンス フィールド用に保存された値を js メソッドに渡す必要があります。
私はそれを好きです、
Dim desc As String = control.Descendants("controlGuidance").First().Attribute("description").Value
lblGuidanceImage.Text = "<img onCliCk=""DisplayControlHelp('" & HttpUtility.HtmlDecode(desc.Replace("\", "\\").Replace("'", "\'")) & "')"" style=""vertical-align:middle; padding-right:2px; cursor: pointer;"" src=""../Images/help.gif"" alt=""Click for additional guidance"" title=""Click for additional guidance"" /> "
今、私が書いた js メソッドは、そのページで radwindow を取得し、渡されたテキストをそのウィンドウに表示する必要があります。
function DisplayControlHelp(helpText) {
var wnd = $find("<%=RdWndGuidance.ClientID %>");
var controlGuidance = document.getElementById("<%= lblControlGuidance.ClientID %>");
helpText = $("<div/>").text(helpText).html();
controlGuidance.innerHTML = helpText;
wnd.show();
}
現在、これは html タグを含まないテキストに対して機能します。
しかし、これは失敗します(画像はページにレンダリングされますが、クリックイベントは機能しません)
<p style="list-style-type: none; font-size: 15px; font-family: Georgia, Century, Times, serif; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 15px; line-height: 21px; padding-right: 0px;border: 0px;">Around 3,000 patients died needlessly last year as a result of poor care, and nearly half a million were harmed unnecessarily in the NHS,<a href="http://www.huffingtonpost.co.uk/news/jeremy-hunt" style="list-style-type: none; color: #058b7b; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; text-decoration: none; margin: 0px; outline-color: invert; padding-right: 0px;border: 0px;" target="_hplink">&nbsp;Jeremy Hunt</a>&nbsp;will say today, as he calls on the health service to tackle the "silent scandal of errors".</p>
<p style="list-style-type: none; font-size: 15px; font-family: Georgia, Century, Times, serif; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 15px; line-height: 21px; padding-right: 0px;border: 0px;">The health service also recorded 326 "never events" - incidents so unacceptable that they should never happen in the last 12 months.</p>
<p style="list-style-type: none; font-size: 15px; font-family: Georgia, Century, Times, serif; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 15px; line-height: 21px; padding-right: 0px;border: 0px;">The figures come amid revelations that the Care Quality Commission&nbsp;<a href="http://www.huffingtonpost.co.uk/2013/06/21/cqc-cover-up-jill-finney_n_3476518.html?utm_hp_ref=uk" style="list-style-type: none; color: #058b7b; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; text-decoration: none; margin: 0px; outline-color: invert; padding-right: 0px;border: 0px;" target="_hplink">covered up a spate of mother and baby deaths</a>&nbsp;at Morecambe Bay Trust, and days after it was&nbsp;shown the NHS had paid up to&nbsp;<a href="http://www.huffingtonpost.co.uk/2013/06/12/nhs-gagging-orders_n_3426090.html" style="list-style-type: none; color: #058b7b; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; text-decoration: none; margin: 0px; outline-color: invert; padding-right: 0px;border: 0px;" target="_hplink">&pound;2million to stop potential NHS whistleblowers</a>from speaking out.</p>
これは、xml に保存された html エンコードされたテキストです。
誰が何が間違っているのか、またはこれを解決するために何をする必要があるのか 教えてもらえますか。私は多くの方法を試しましたが、まだ運がありません。
どんな助けでも大歓迎です。