Jul 08, 2015, 7:08 PM
Displaying Outlook.msg in an HTMLEditor control on page load
Hello,
I have been wracking my brain trying to figure this one out. I have a simple HtmlEditor control. My intent is to load an Outlook .msg body content into this editor on page load. The problem I am having is that no matter whether i set the .Text or .Value of the control to the body content, or use .SetValue() in the same manor, the content is not displayed inside the control, but outside of it. Here's my code:
1.This is the Editor control:
The content i'm trying to set inside of the "Edit Template" htmlEditor control is appearing above the entire panel i have it created in. I can't for the life of me figure out what's causing it or what i can do to get it to display correctly. Can anyone please offer me some insight into this?
Thanks for your time,
Mick
I have been wracking my brain trying to figure this one out. I have a simple HtmlEditor control. My intent is to load an Outlook .msg body content into this editor on page load. The problem I am having is that no matter whether i set the .Text or .Value of the control to the body content, or use .SetValue() in the same manor, the content is not displayed inside the control, but outside of it. Here's my code:
1.This is the Editor control:
<ext:HtmlEditor ID="eEmail"
runat="server"
Width="610"
Height="505"
EnableAlignments="false"
EnableFontSize="false">
</ext:HtmlEditor>
2. This is the code behind where i get and set the body content:
Dim outlookApp As New Microsoft.Office.Interop.Outlook.Application
Dim item = TryCast(outlookApp.Session.OpenSharedItem("C:\test.msg"), Microsoft.Office.Interop.Outlook.MailItem)
Dim body As String = item.HTMLBody
ViewData("eBody") = body
3. And here's the pageLoad script setting the .Text/.Value/.SetValue() of the control:<script runat="server">
Protected Sub pageLoad(sender As Object, e As System.EventArgs)
eEmail.SetValue(ViewData("eBody"))
End Sub
</script>
OR<script runat="server">
Protected Sub pageLoad(sender As Object, e As System.EventArgs)
eEmail.Text = ViewData("eBody").ToString
End Sub
</script>
OR<script runat="server">
Protected Sub pageLoad(sender As Object, e As System.EventArgs)
eEmail.Value = ViewData("eBody").ToString
End Sub
</script>
The output that i get, regardless of how i set the eEmail editor control is the following:The content i'm trying to set inside of the "Edit Template" htmlEditor control is appearing above the entire panel i have it created in. I can't for the life of me figure out what's causing it or what i can do to get it to display correctly. Can anyone please offer me some insight into this?
Thanks for your time,
Mick
Last edited by Daniil; Aug 21, 2015 at 2:42 PM.