how to: Collect entire form's html code

Discussion in 'ASP .Net' started by Ryan McLean, Nov 11, 2003.

  1. Ryan McLean

    Ryan McLean Guest

    Hello everyone!

    What I am trying to accomplish is as follows: I have a .aspx page
    where I display the user's information. This consists of a datagrid,
    several labels, etc. I would like to send this same information in
    the body of an email. Now, I know I could simply rewrite the contents
    into an html string thingy and just put stuff like
    strMailBody="<html><body><table><tr><td>First name:</td><td>" &
    Me.txtFirstName.Text & " . . . and so forth, but I am trying to figure
    out if there is a way to grab information that is printed onto the
    screen. I have looked into readHtmlPage, is there any other way I
    might accomplish this. I am hoping that I could just put everything
    that I need into an asp:tablecell and capture everything that way. As
    you probably know this failed miserably.

    Any ideas?

    Thanks in advance!

    Ryan
     
    Ryan McLean, Nov 11, 2003
    #1
    1. Advertisements

  2. You can email a page to somebody using the WebRequest and MailMessage
    classes for this functionality.
    Here are a couple examples:

    http://www.aspalliance.com/stevesmith/articles/dotnetemailwebsite.asp

    http://aspnet.4guysfromrolla.com/articles/091102-1.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "Ryan McLean" <> wrote in message
    news:...
    > Hello everyone!
    >
    > What I am trying to accomplish is as follows: I have a .aspx page
    > where I display the user's information. This consists of a datagrid,
    > several labels, etc. I would like to send this same information in
    > the body of an email. Now, I know I could simply rewrite the contents
    > into an html string thingy and just put stuff like
    > strMailBody="<html><body><table><tr><td>First name:</td><td>" &
    > Me.txtFirstName.Text & " . . . and so forth, but I am trying to figure
    > out if there is a way to grab information that is printed onto the
    > screen. I have looked into readHtmlPage, is there any other way I
    > might accomplish this. I am hoping that I could just put everything
    > that I need into an asp:tablecell and capture everything that way. As
    > you probably know this failed miserably.
    >
    > Any ideas?
    >
    > Thanks in advance!
    >
    > Ryan
     
    Steve C. Orr [MVP, MCSD], Nov 11, 2003
    #2
    1. Advertisements

  3. Ryan McLean

    SSW Guest

    Hi Ryan,

    U Can use Server.Execute. Using this u get string writer with HTNL Code. Which u can send it via Email in HTML format.

    Below is the sample code which grap HTML Code and Display it user.
    ---------------------------------------------------------------------------------------------------------------------------------------
    Code for HTML Graber
    ---------------------------------------------------------------------------------------------------------------------------------------
    writer StringWriter = new StringWriter();
    Server.Execute("UrAspPage.aspx", writer);
    Response.Write("<H3>Ur Page will be: </H3><br>" & writer.ToString());
    ---------------------------------------------------------------------------------------------------------------------------------------
    Code End
    ---------------------------------------------------------------------------------------------------------------------------------------

    Hope this helps.

    Thanks,

    sswalia
    MCSD, MCAD, OCA


    "Ryan McLean" <> wrote in message news:...
    > Hello everyone!
    >
    > What I am trying to accomplish is as follows: I have a .aspx page
    > where I display the user's information. This consists of a datagrid,
    > several labels, etc. I would like to send this same information in
    > the body of an email. Now, I know I could simply rewrite the contents
    > into an html string thingy and just put stuff like
    > strMailBody="<html><body><table><tr><td>First name:</td><td>" &
    > Me.txtFirstName.Text & " . . . and so forth, but I am trying to figure
    > out if there is a way to grab information that is printed onto the
    > screen. I have looked into readHtmlPage, is there any other way I
    > might accomplish this. I am hoping that I could just put everything
    > that I need into an asp:tablecell and capture everything that way. As
    > you probably know this failed miserably.
    >
    > Any ideas?
    >
    > Thanks in advance!
    >
    > Ryan
     
    SSW, Nov 11, 2003
    #3
  4. Ryan McLean

    Ryan McLean Guest

    You are both awesome! Thank for the fast responses!

    I'm sure one of these suggestions will be perfect. Now for the research . . .

    Thanks again and have a great week!

    Ryan

    "SSW" <> wrote in message news:<>...
    > Hi Ryan,
    >
    > U Can use Server.Execute. Using this u get string writer with HTNL Code.
    > Which u can send it via Email in HTML format.
    >
    > Below is the sample code which grap HTML Code and Display it user.
    > -------------------------------------------------------------------------
    > --------------------------------------------------------------
    > Code for
    > HTML Graber
    > -------------------------------------------------------------------------
    > --------------------------------------------------------------
    > writer StringWriter = new StringWriter();
    > Server.Execute("UrAspPage.aspx", writer);
    > Response.Write("<H3>Ur Page will be: </H3><br>" & writer.ToString());
    > -------------------------------------------------------------------------
    > --------------------------------------------------------------
    > Code End
    > -------------------------------------------------------------------------
    > --------------------------------------------------------------
    >
    > Hope this helps.
    >
    > Thanks,
    >
    > sswalia
    > MCSD, MCAD, OCA
    >
    >
    > "Ryan McLean" <> wrote in message
    > news:...
    > > Hello everyone!
    > >
    > > What I am trying to accomplish is as follows: I have a .aspx page
    > > where I display the user's information. This consists of a datagrid,
    > > several labels, etc. I would like to send this same information in
    > > the body of an email. Now, I know I could simply rewrite the contents
    > > into an html string thingy and just put stuff like
    > > strMailBody="<html><body><table><tr><td>First name:</td><td>" &
    > > Me.txtFirstName.Text & " . . . and so forth, but I am trying to figure
    > > out if there is a way to grab information that is printed onto the
    > > screen. I have looked into readHtmlPage, is there any other way I
    > > might accomplish this. I am hoping that I could just put everything
    > > that I need into an asp:tablecell and capture everything that way. As
    > > you probably know this failed miserably.
    > >
    > > Any ideas?
    > >
    > > Thanks in advance!
    > >
    > > Ryan

    >
    > --
     
    Ryan McLean, Nov 12, 2003
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig Kenisston

    HTML code warnings in asp.net html code view

    Craig Kenisston, Oct 7, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,387
    Martin Dechev
    Oct 7, 2004
  2. Alex
    Replies:
    4
    Views:
    5,393
  3. Shawn Berg

    Accessing entire Web Form HTML Source

    Shawn Berg, Feb 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    532
    Shawn Berg
    Feb 3, 2005
  4. Chris
    Replies:
    4
    Views:
    10,750
    Chris
    Feb 3, 2006
  5. Chris Cairns

    Collect string from HTTP Form POST

    Chris Cairns, Jul 10, 2003, in forum: ASP General
    Replies:
    2
    Views:
    250
    Mark Schupp
    Jul 10, 2003
  6. c676228
    Replies:
    3
    Views:
    254
    ChigbuaUmuenu
    Oct 7, 2006
  7. Mr. x

    make entire form invisible

    Mr. x, Nov 19, 2003, in forum: Javascript
    Replies:
    3
    Views:
    167
    Vjekoslav Begovic
    Nov 19, 2003
  8. Son KwonNam

    copying entire form objects to another form??

    Son KwonNam, Jan 11, 2006, in forum: Javascript
    Replies:
    3
    Views:
    294
Loading...