无法将数据从SQL插入ASP.NET中的div html [英] Can't insert data from SQL to a div's html in ASP.NET

查看:31
本文介绍了无法将数据从SQL插入ASP.NET中的div html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将html文本插入div时(我将其设置为runat = server,并用html文本填充了div.看起来像这样,

When i try to insert html text into a div (i made it runat=server and i populate the div with html text. it's look like this,

string htmlData = "< html > blabla...< /html >";
divcontent.innerHtml = htmlData;

页面已损坏.

但是当我采用相同的html数据并将其按原样放置在html文件中时,其显示正确.我应该考虑些什么?

but when i take the same html data and put it as is in an html file its shows properly. what should i take in consider ?

p.s.我正在用asp.net(c#)VS2005编写.

p.s. i am writing in asp.net (c#) VS2005.

推荐答案

我找到了解决我问题的灵魂.我需要从页面上删除DOCTYPE标记.它与我的html字符串引起矛盾.我不知道该用什么代替它,但是它对我有用...

i found the soultion to my problem. i needed to remove the DOCTYPE tag from my page. it causes a contradiction with my html string. i dont know what to replace it with but it works for me...

这篇关于无法将数据从SQL插入ASP.NET中的div html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆