问题描述
您好,
我保存为HTML的MSSQL HTML数据无法再次显示。
文本区域HtmlEditorExtender和网格文本区域HtmlEditorExtender。
我如何制作。
数据库表:
Hello,
HTML data to MSSQL I saved as HTML can not be displayed again.
text area HtmlEditorExtender and grid text area HtmlEditorExtender.
How do I make.
database table:
CREATE TABLE [dbo].[XHABER] (
[ID] BIGINT IDENTITY (1, 1) NOT NULL,
[HABER] NVARCHAR(MAX) NOT NULL,
[ADSOYAD] NVARCHAR (50) NULL,
[CREATEDATE] DATETIME2 (7) DEFAULT (getdate()) NULL
);
aspx; HtmlEditorExtender文本区:
aspx; HtmlEditorExtender text area:
<asp:TextBox ID="txtAcik" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="132px"
MaxLength="4096" TextMode="MultiLine" Width="940px" style="margin-left: 0px" BackColor="White">
<asp:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txtAcik">
grid ItemTemplate:
grid ItemTemplate:
<itemtemplate>
<asp:TextBox ID="TextBoxText" runat="server" Width="900px" TextMode="MultiLine" Text='<%# Bind("HABER") %>' Height="150">
<asp:HtmlEditorExtender ID="HtmlEditorExtender1" TargetControlID="TextBoxText" DisplaySourceTab="false" runat="server">
<toolbar>
<asp:Undo />
<asp:Redo />
<asp:Copy />
<asp:Paste />
</toolbar>
save sql命令;
save sql command;
String query = "INSERT INTO XHABER " +
" (HABER,ADSOYAD,CREATEDATE)" +
" VALUES " +
" (@HABER,@ADSOYAD,@CREATEDATE)";
SqlCommand sqlCommand = new SqlCommand(query, sqllConn);
sqlCommand.Parameters.Add("@HABER", SqlDbType.NVarChar, 19000, "HABER");
sqlCommand.Parameters.Add("@ADSOYAD", SqlDbType.NVarChar, 50, "ADSOYAD");
sqlCommand.Parameters.Add("@CREATEDATE", SqlDbType.DateTime, 100, "CREATEDATE");
sqlCommand.Parameters["@HABER"].Value = txtAcik.Text;
sqlCommand.Parameters["@ADSOYAD"].Value = Session["ADSOYAD"];
sqlCommand.Parameters["@CREATEDATE"].Value = DateTime.Now.ToString();
sqlCommand.Transaction = sqlTransaction;
sqlCommand.ExecuteNonQuery();
sqlTransaction.Commit();
它会在文本部分中显示html代码。
sample;
<span lang =EN-USstyle =;> http://www.sahibinden.com/ilan/vasita-otomobil-toyota-ogretmenden -boyasiz-kazasiz-orijinal-auris-207668650 / detay
It turns html code in the text section.
sample;
"<"span lang="EN-US" style=";">http://www.sahibinden.com/ilan/vasita-otomobil-toyota-ogretmenden-boyasiz-kazasiz-orijinal-auris-207668650/detay""
推荐答案
这篇关于Ajax HtmlEditorExtender数据库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!