473,395 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Knowledge Base: Generating e-mails in ASP.NET

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:so******@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...
Nov 19 '05 #1
2 1550
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,

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.s
ele
ctedIndex].text);
var controlRange;
if (document.body.createControlRange)
{
controlRange = document.body.createControlRange();
controlRange.addElement(oDiv);
controlRange.execCommand('Copy');
oWin = window.open('mailto:so******@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...


Nov 19 '05 #2
Thank you much!
"Matt Berther" <mb******@hotmail.com> wrote in message news:22***************************@news.microsoft. com...
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,

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.s
ele
ctedIndex].text);
var controlRange;
if (document.body.createControlRange)
{
controlRange = document.body.createControlRange();
controlRange.addElement(oDiv);
controlRange.execCommand('Copy');
oWin = window.open('mailto:so******@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...



Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dirk Rudolf | last post by:
I like to announce you the product X2U, avaible under http://www.lumrix.net/x2. X2U is an acronym for "XML to user". Existing XML editors still ignore the fact that users don't want to read XML...
0
by: Popoxinhxan | last post by:
Could any one help me to do the knowledge base directory using vs C#, mssql server 2000 and xml web service like the www.strikeiron.com knowledge base but in window form application instead of the...
0
by: vladislav.moltchanov | last post by:
I am developing an Access tool for generating an Application MDB for data entry in a "large scale" project. At design stage I would like to keep open these two MDB. One current is generating forms...
0
by: Sushil Srivastava | last post by:
Hi Guys, I have developed a utility that provide a smart MSDN knowledge base search both off-line and on-line. I have describe more in detail below why I decided to write this utility (one...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
2
by: Spam Catcher | last post by:
Hello, Does anyone have a recommendation for knowledge base software for ASP.NET? Any open source solutions out there? I'm looking for a system which I can integrate into existing pages if...
2
by: nano2k | last post by:
Hi It's maybe offtopic, but do you guys have an ideea of how to develop an knowledge base for troubleshooting an application? Picture this. After deploying an application to multiple locations,...
2
by: bmomalley | last post by:
Hi Folks, I need help, because I am just at a loss. I'm not super comfortable with XML, but I'm trying to fight my way through generating an RSS XML file for Google Base, and I'm stuck with a...
6
by: Adam C. | last post by:
We have a situation where we want a Swig-generated Python class to have a different base (not object). It doesn't appear that we can coerce Swig into generating the class we want at present (but we...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.