我正在尝试从后面的代码中为div分配一个innerhtml值。这是我得到的:
private void ModalBody()
{
LoadTemplateOverride();
divModalBody.InnerHtml =
}
private void LoadTemplateOverride()
{
string templateURL = String.Format("{0}/leadgen/eodemails/templatecontroller.aspx?eodid={1}", site.Get("InternalApiUrl"), Email.ID);
HttpWebRequest request = HttpWebRequest.Create(templateURL) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
tbSubject.Text = response.Headers["EmailSubject"];
tbBody.Text = (new StreamReader(response.GetResponseStream())).ReadToEnd();
}
答案 0 :(得分:0)
也许你可以使用Literal
控件。它会将您在Text
属性上放置的内容输出到呈现的HTML。
标记:
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
代码背后:
Literal1.Text = "<div>Some <strong>nice</strong> HTML</div>";