Click to See Complete Forum and Search --> : Emailing HTML on demand
broadvision123
Jun 13th, 2005, 03:10 PM
I've created a configuration application that allows users to create systems which is kind of like the dell web site. When the user is finished configuring they get a summary of all the items they have choosen. I want them to be able click a button and email the content of the web page. Currently the application doesn't save the data they have chosen in a database.
Is there a way to click a button and have the currently html page sent to an email account?
Thanks!
James
broadvision123
Jun 13th, 2005, 03:23 PM
I wanted to let you also know that the page I'm trying to email has panels. So when I view the source on the page I would like to send via an email I see the first panel html.
Thanks!
Danial
Jun 13th, 2005, 04:22 PM
Use ClientSide JavaScript to read the OuterHTML of the Panel(Div) and then put it on a hidden inputfield(Serverside), then Read the value of the input field from serverside and Email it...I have used this and works like a charm. There are other ways but this is the most easiest and quick way..
broadvision123
Jun 13th, 2005, 04:24 PM
Do you have the code for this? This would be a great help.
Thanks!
James
Danial
Jun 14th, 2005, 03:27 AM
Code behind
Public Class WebForm9
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 txtHTML As System.Web.UI.HtmlControls.HtmlInputHidden
Protected WithEvents btnEmail As System.Web.UI.WebControls.Button
Protected WithEvents Table1 As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents txtOutput As System.Web.UI.WebControls.TextBox
'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
Me.btnEmail.Attributes.Add("onclick", "CopyHTML('" & Me.txtHTML.ClientID & "', '" & Me.Table1.ClientID & "');")
End Sub
Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
Dim html As String
html = Me.txtHTML.Value
Me.txtOutput.Text = html
Me.txtOutput.Visible = True
End Sub
End Class
aspx file
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm9.aspx.vb" Inherits="Junk.WebForm9" validateRequest=false %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm9</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>
function CopyHTML(target, source)
{
document.getElementById(target).value = document.getElementById(source).outerHTML
//alert(document.getElementById(target).value);
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT id="txtHTML" style="Z-INDEX: 102; LEFT: 280px; POSITION: absolute; TOP: 200px" type="hidden"
name="Hidden1" runat="server">
<asp:Button id="btnEmail" style="Z-INDEX: 103; LEFT: 456px; POSITION: absolute; TOP: 200px"
runat="server" Text="Email"></asp:Button>
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 272px; WIDTH: 552px; POSITION: absolute; TOP: 88px; HEIGHT: 75px"
cellSpacing="1" cellPadding="1" width="552" border="1" runat="server">
<TR>
<TD style="WIDTH: 118px">data</TD>
<TD>data</TD>
<TD>data</TD>
</TR>
<TR>
<TD style="WIDTH: 118px">data</TD>
<TD>data</TD>
<TD></TD>
</TR>
<TR>
<TD style="WIDTH: 118px">data</TD>
<TD>data</TD>
<TD>data</TD>
</TR>
</TABLE>
<asp:TextBox id="txtOutput" style="Z-INDEX: 104; LEFT: 272px; POSITION: absolute; TOP: 272px"
runat="server" Width="416px" Visible="False" Height="296px" TextMode="MultiLine"></asp:TextBox>
</form>
</body>
</HTML>
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.