Hello,
I am trying to develop an interface to view an internal knowledge base. One feature I would like to add is a "Generate E-Mail" button which would automatically open an e-mail message a populate it with the title and the article from the knowledge base. Each KBase item contains a title and article where the article contains HTML formatting. So far, I have used a client-side JavaScript block to perform this task along with an HTML control.
i.e.
<INPUT onclick=GenerateEMail() type=button value="Generate E-mail" name=btnEmail />
...
function GenerateEMail()
{
oDiv = document.all.pnlArticle;
oDiv.contentEditable = 'true';
if (oDiv.innerHTML != '')
{
subject = escape(document.frmKBase.lstTitle.options[document.frmKBase.lstTitle.selectedIndex].text);
var controlRange;
if (document.body.createControlRange)
{
controlRange = document.body.createControlRange();
controlRange.addElement(oDiv);
controlRange.execCommand('Copy');
oWin = window.open('mailto:somebody@nowere.com?subject='+ subject);
}
oDiv.contentEditable = 'false';
}
else
{
alert('Please select an article!');
}
I use the copy command to the clipboard so that the HTML formatting is not lost. The problem with this method is that you need to perform a paste when the e-mail message window opens up.
Is there a way to have the article pasted automatically?
Is there a way of doing this all in ASP.NET?
TIA
Matt Berther - 12 Mar 2005 02:46 GMT
Hello Blue,
Try something (code from memory, so it may not be perfect) like this hooked
up to a button:
string html = "";
using (StringWriter sw = new StringWriter())
{
Html32TextWriter hw = new Html32TextWriter(sw);
pnlArticle.RenderControl(hw);
hw.Close();
html = sw.ToString();
}
At this point, you have an HTML representation of the content in the pnlArticle
panel. Look at System.Web.Mail [1] for information on how to send the email.
You'll want to make sure to set the MailFormat property.
[1] http://www.systemwebmail.net
--
Matt Berther
http://www.mattberther.com
> Hello,
>
[quoted text clipped - 46 lines]
>
> TIA...
Blue Streak - 14 Mar 2005 16:03 GMT
Thank you much!
> Hello Blue,
>
[quoted text clipped - 70 lines]
> >
> > TIA...
milto - 30 Oct 2009 23:38 GMT
quiero
From http://www.google.com.ec/search?hl=es&client=firefox-a&channel=s&rls=org.mozilla
:es-ES:official&hs=Ysf&q=www.owin3d.ec&btnG=Buscar&meta=&aq=f&oq
Posted via DevelopmentNow.com Group
http://www.developmentnow.com/g/