Results 1 to 5 of 5

Thread: Emailing HTML on demand

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    27

    Emailing HTML on demand

    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

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    27

    Re: Emailing HTML on demand

    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!

  3. #3
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Emailing HTML on demand

    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..
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    27

    Re: Emailing HTML on demand

    Do you have the code for this? This would be a great help.

    Thanks!
    James

  5. #5
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Emailing HTML on demand

    Code behind
    VB Code:
    1. Public Class WebForm9
    2.     Inherits System.Web.UI.Page
    3.  
    4. #Region " Web Form Designer Generated Code "
    5.  
    6.     'This call is required by the Web Form Designer.
    7.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    8.  
    9.     End Sub
    10.     Protected WithEvents txtHTML As System.Web.UI.HtmlControls.HtmlInputHidden
    11.     Protected WithEvents btnEmail As System.Web.UI.WebControls.Button
    12.     Protected WithEvents Table1 As System.Web.UI.HtmlControls.HtmlTable
    13.     Protected WithEvents txtOutput As System.Web.UI.WebControls.TextBox
    14.  
    15.     'NOTE: The following placeholder declaration is required by the Web Form Designer.
    16.     'Do not delete or move it.
    17.     Private designerPlaceholderDeclaration As System.Object
    18.  
    19.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    20.         'CODEGEN: This method call is required by the Web Form Designer
    21.         'Do not modify it using the code editor.
    22.         InitializeComponent()
    23.     End Sub
    24.  
    25. #End Region
    26.  
    27.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    28.         Me.btnEmail.Attributes.Add("onclick", "CopyHTML('" & Me.txtHTML.ClientID & "', '" & Me.Table1.ClientID & "');")
    29.     End Sub
    30.  
    31.     Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
    32.         Dim html As String
    33.         html = Me.txtHTML.Value
    34.  
    35.  
    36.         Me.txtOutput.Text = html
    37.         Me.txtOutput.Visible = True
    38.     End Sub
    39. End Class

    aspx file
    VB Code:
    1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm9.aspx.vb" Inherits="Junk.WebForm9" validateRequest=false %>
    2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    3. <HTML>
    4.     <HEAD>
    5.         <title>WebForm9</title>
    6.         <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    7.         <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    8.         <meta name="vs_defaultClientScript" content="JavaScript">
    9.         <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    10.         <script>
    11.     function CopyHTML(target, source)
    12.     {
    13.         document.getElementById(target).value = document.getElementById(source).outerHTML
    14.        
    15.         //alert(document.getElementById(target).value);
    16.        
    17.     }
    18.         </script>
    19.     </HEAD>
    20.     <body MS_POSITIONING="GridLayout">
    21.         <form id="Form1" method="post" runat="server">
    22.             <INPUT id="txtHTML" style="Z-INDEX: 102; LEFT: 280px; POSITION: absolute; TOP: 200px" type="hidden"
    23.                 name="Hidden1" runat="server">
    24.             <asp:Button id="btnEmail" style="Z-INDEX: 103; LEFT: 456px; POSITION: absolute; TOP: 200px"
    25.                 runat="server" Text="Email"></asp:Button>
    26.             <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 272px; WIDTH: 552px; POSITION: absolute; TOP: 88px; HEIGHT: 75px"
    27.                 cellSpacing="1" cellPadding="1" width="552" border="1" runat="server">
    28.                 <TR>
    29.                     <TD style="WIDTH: 118px">data</TD>
    30.                     <TD>data</TD>
    31.                     <TD>data</TD>
    32.                 </TR>
    33.                 <TR>
    34.                     <TD style="WIDTH: 118px">data</TD>
    35.                     <TD>data</TD>
    36.                     <TD></TD>
    37.                 </TR>
    38.                 <TR>
    39.                     <TD style="WIDTH: 118px">data</TD>
    40.                     <TD>data</TD>
    41.                     <TD>data</TD>
    42.                 </TR>
    43.             </TABLE>
    44.             <asp:TextBox id="txtOutput" style="Z-INDEX: 104; LEFT: 272px; POSITION: absolute; TOP: 272px"
    45.                 runat="server" Width="416px" Visible="False" Height="296px" TextMode="MultiLine"></asp:TextBox>
    46.         </form>
    47.     </body>
    48. </HTML>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width