Thanks for Curt and Yama's good suggestions.
Hi Rod,
As for your questions, I think you may have a look at Yama's sample page
code which demonstrate the suggestion that write a "window.open" script to
client in code behind code.
In addtion, I've also another suggestion here:
Since generally we can open the default mail client via click a hyperlink
as below:
<a
href="mailto:
[email protected]?subject=Test&body=This%20is%20a%20Tex
t">MailTo</a>
So I think we can put a certain hyperlink on the page and set it as
invisiable ( using style="display:none"). Then register a clientside script
to fire the hyper link 's click event. Thus, we can also make the client
popup the default mail client and the underlying page is stll remaining. To
make it clearly, here is a demo page I've tested, please have a look to see
whether it helps:
----------------------------aspx page----------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>MailTo</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function doSendMail()
{
document.getElementById("lnkMailTo").click();
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table align="center" width="100%">
<tr>
<td>
<asp:Label id="lblMessage" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td><a id="lnkMailTo" style="display:none"
href="mailto:
[email protected]?subject=Test&body=This%20is%20a%20Tex
t">MailTo</a></td>
</tr>
<tr>
<td>
<asp:LinkButton id="btnSendMail" runat="server">Send
Mail</asp:LinkButton>
</td>
</tr>
</table>
</form>
</body>
</HTML>
------------------code behind page class--------------------
Public Class MailTo
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
Protected WithEvents btnSendMail As System.Web.UI.WebControls.LinkButton
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSendMail.Click
Dim script As String = "<script
language='javascript'>doSendMail();</script>"
Page.RegisterStartupScript("sendmail", script)
lblMessage.Text = "Please Complete the Mail and Send it."
End Sub
End Class
----------------------------------------------
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx