Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 14th, 2006, 11:14 PM
Registered User
 
Join Date: Sep 2006
Location: Marion, IN, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form email Questions

I am trying to do my first ASP webpage and it is a form to fill out and email the results. I am having trouble with the message text (BTW I am doing this in Dreamweaver if that matters). Anyway I am trying to do two things.

1. Below is my message text. I would like each of the elements to fall on different lines in the email, that is name on line 1, address on line 2 etc. Anyway, I cannot get line breaks to work in here to save my life. Everytime I change something I get a new error. For example with the below code I get a CS1002 error which I think means it is looking for a semi colon. Of course there are no line breaks in the code below because they don't work....I just don't get it.

message.Body = "Name: " + txtName.Text + "Address: " + txtAddress.Text + "City, State Zip: " + txtCity.Text + ", " + txtState.Text + " " + txtZip.Text + "Phone: " + txtPhone.Text + "email: " + txtEmail.Text + "Message: " txtMessage.Text;

2. After they hit submit I would also like a pdf to open up in another window. How do I do that?

John C Toennies
Reply With Quote
  #2 (permalink)  
Old September 15th, 2006, 06:23 AM
Authorized User
 
Join Date: Sep 2006
Location: Bangalore, Karnataka, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI John, You are trying to do the same using ASP (VB Script right) or is that code given below in Javascript. If you are using VB SCript then you need to use & instead of + and there is no need for the semicolon at the end.

If its is not working to help you in debugging, dont use all the fields, try with a field or two only and see if the error persits, and then try adding the rest of the fields.

As for opening a pdf window, you can use response.redirect("pdffile.pdf"). To open in a new window, i am not sure, but will check and post it here.

Vincent Thomas
Bangalore
Reply With Quote
  #3 (permalink)  
Old September 15th, 2006, 07:09 AM
Registered User
 
Join Date: Aug 2006
Location: Farnborough, Hampshire, United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to simonwilbert Send a message via Yahoo to simonwilbert
Default

you are missing a + right at the end of the statement....:D

should be
     ...Message: " + txtMessage.Text;

Simon Hurley
simon.hurley@mail.com
Reply With Quote
  #4 (permalink)  
Old September 15th, 2006, 07:54 AM
Registered User
 
Join Date: Sep 2006
Location: Marion, IN, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I hav tried this with just two fields and all of them and it is driving me nuts! G<> Any thoughts on a line feed so it looks better in the email? Also, thoughts about opening up the pdf in a new window and maybe redirecting to a different page?

John C Toennies
Reply With Quote
  #5 (permalink)  
Old September 15th, 2006, 10:58 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

First the line breaks:

Is your message format HTML or Text? For text you should use: "\r\n"; to give you a carriage return and a line feed and if its HTML use the <br> tag. (If you have tried using "\r\n"; I am not quite sure why it isnt working as I have this implemented in one of my applications and it works fine.)

For the pdf window, just send a javascript window.open() command to the browser and spawn a new window that loads your pdf.

hth.



--Stole this from a moderator

I will only tell you how to do it, not do it for you.

Unless, of course, you want to hire me to do work for you.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
form with conditional questions jcrowley PHP How-To 0 January 30th, 2007 12:02 AM
Access Form Questions sario777 Access 2 April 12th, 2005 06:38 PM
Javascript Form Questions The_Jackal Javascript How-To 0 August 24th, 2004 12:50 PM
First normal form and attachement questions?? wasaan SQL Server 2000 2 July 17th, 2003 09:43 AM



All times are GMT -4. The time now is 08:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.