1
I’m using the HtmlEditorExtender
of Ajaxtoolkit and in it I enabled the option to insert an image to the body of the text.
<asp:TextBox ID="txtDescricao" runat="server" TextMode="MultiLine" Rows="5"
Width="100%" Height="100%"></asp:TextBox>
<asp:RequiredFieldValidator SetFocusOnError="True" runat="server"
ControlToValidate="txtDescricao" ValidationGroup="SalvarNoticia">
</asp:RequiredFieldValidator>
<ajaxtoolkit:HtmlEditorExtender runat="server" ID="heeDescricao"
TargetControlID="txtDescricao" DisplaySourceTab="true" EnableSanitization="false"
OnImageUploadComplete="heeDescricao_ImageUploadComplete">
<Toolbar>
...
<ajaxtoolkit:InsertImage />
...
</Toolbar>
</ajaxtoolkit:HtmlEditorExtender>
On another page I separated one <div>
to demonstrate the content of the text.
So I did like this:
<asp:Panel ID="pnlDescricao" SkinID="PanelMain" runat="server" Height="70px">
<div id="txtDescricao" runat="server">
</div>
</asp:Panel>
And in the Code-Behind of this demo page return the text in this way:
var obj = new Business.Texto().Obter(id);
if (obj != null)
{
...
txtDescricao.InnerHtml = obj.Descricao;
...
}
I am using SQL Server and saving the content in a field of type text, and charge to a property of the type string
.
The screen renders the html code, not the image itself:
Example:
And the source of html when inspecting the elemtno appears like this:
<div id="CPHConsultaBody_pnlDescricao"
class="ui-widget ui-widget-content ui-corner-all"
style="height:70px;padding:2px;margin-top:2px;padding:5px;">
<div id="CPHConsultaBody_txtDescricao">
<imgsrc="/Arquivos/temp/20140603091536649/wall-smiley.jpg"></div>
</div>
How can I solve this problem?
@Trembling you put it like this:
<asp:Literal runat="server" ViewStateMode="Enabled" ID="LiteralDescricao" ClientIDMode="Static" Mode="Transform"></asp:Literal>
? with Mode="Transform" ?– user6026
@Tremdoido do a Debug in the assignment
obj.Descricao;
before you play Literal and talk to me like you’re coming to String Bank?– user6026
I’ll edit it and you put it in your code
– user6026