Hello there,
I am having an issue decoding html text saved in the database and displaying it in a label. Everything else will decode other than the image tag. For Example
<span style="background-color: #ff6633;"><b>Maxiums Prime</b></span> &lt;img src="/newsletter/Images/events.jpg"&gt;<br>
Will decode to Maxiums Prime to bold and displays the red background color. But the image does not show and the tag<img src="/newsletter/Images/events.jpg"> is shown instead. How do I fix this so that both the text and image will display
in the label? Here's my code.
Protected Sub contentload()
Dim Myconn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\nldb.mdf;Integrated Security=True;User Instance=True; MultipleActiveResultSets=True")
Dim dr As SqlDataReader
Dim maxval As Integer
Dim curnl As Integer
Dim htmltext As String
Dim mycomm1 As New SqlCommand("SELECT MAX(ID) as MAXID from createnl", Myconn)
myConn.Open()
dr = mycomm1.ExecuteReader()
Try
While dr.Read()
maxval = dr("MAXID")
End While
curnl = maxval
Dim mycommand As New SqlCommand(("Select nlhtml from createnl where id = @maxval"), Myconn)
mycommand.Parameters.AddWithValue("@maxval", maxval)
dr = mycommand.ExecuteReader()
While dr.Read()
htmltext = dr("nlhtml")
nlcontent.Text = HttpUtility.HtmlDecode(htmltext)
End While
Finally
dr.Close()
Myconn.Close()
End Try
End SubI have also tried
Server.htmlDecode(htmltext)
but it returns the output in the same way. I'm sure I must be missing something but I cannot figure it out. Please help!
Thank you in advance,
Sai.