WorldofASP.NET : ASP.NET Directory, Tutorial, Hosting, and Source Code
You are 1 of 54 users


WorldofASP.NET >> ASP.NET >> Unedited ASP.NET

Simple asp2 feedback form

A simple way to get user feedback via webpage email.
Published Date : 21 Feb 2008
Author : kane nelson
Language : VB.NET
Platform : Wins,.NET
Technology : Visual Studio,ASP.NET
Views : 9086
Rating : (1 votes so far)



Introduction

Hi everyone, im not a professional developer by far.... but for many years when I began I struggled to find good tutorials for me as a beginner. All were alot more advanced & refered to items & means I had NO idea of at all which then made trying to teach yourself impossible!!.

I wanted Just simple straight to the point and the type that explained JUST what i needed to know to
progress, nothing more Nor less.

In this article I will show the beginners out there how to make a feedback form, that sends you the
contents in an email simply, using the System.net.mail Or i use System.web.mail namespace.
This can easily be developed on and hopefully helps a lot of the new comers to progression in mailing
 from web pages. 

Note this feedback form will only run on host's that are asp/2 compatible (windows) servers.

Main

Step 1:
Lets start by making a simple aspx page through visual studio, call it "Feedback.aspx" & don't add a
 code behind page (no use here we'll script it in YAY!). Now the 1st couple of lines of our page should
read as below, if not change it to so.



Note: you'll see we add the session state to false so we dont get our form holding data, and i
always like to import our namespaces so do like above.

Also add Or make sure your document type & declarations are like below as its a good practice to get
into when creating W3C webpages by standards XHTML Strict is a must!.



Step 2:

the <body> of our document if it's an aspx page will already have a <form> element if not add one,
inside this lets add our feedback form controls i always use a table to keep things neat ... as code
below:

Pay particular attention to our submit button, the onclick : onserverclick="btn_Click()" we'll add
this code a little later.

Here's an image of how the layout should look Or you can dizzy it up to your own style & like:


Yay we're off and running, there's nothing in that block of code you really need pay attention to. All we
have really done if your looking at your page in design mode is add a table with 5 new controls ; Name,
 email, subject, message & submit
.These will be our email message area's, lets move on.

Step 3:
Just below our table lets add our label for the response once the feedback is submitted. Do so as
below, note i add the label text in Orange for effect of catching attention after a submission.



Now for the fun part lets get cracking at putting our coding skills to good use, Right back up the top of
 our page, somewhere above the <head> element lets setup our functions & mail object.

Step 4:
First of all we'll add our <script> tags as so and be sure to specify language type:


then we add our page load function like so on the very next line, you'll notice the page load specifies if our page is a postback then set the label response to what ever we want to say once the email is sent Or else the user needs to fill in the email feild of our form.


Step 5:
Now last but not least our button click Or submit form. Let's go through the below code, if our request forms email field = to nothing then create new message, add from text, to text (Note: this will be your email address that you want to receive email on), subject from our drop down list, emailbody from our text area Or note i've also added some HTML, along with the users name and attached both via " code here" & " code here" statements, next is  body format (Note: you can set this to what ever you like), smtp server (Note: this will be your email hosting server address to send emails) & finally our mail object name we created at the IF statement at our button click beginning.



Conclusion

And that My friends is just about it your page can now be uploaded to your ASP(windows) host and
send you form feedback to no end ! *smile* . I hope many of you enjoyed this and as you can see with
 a little tinkering it could easily be added to, such as a user control for sending personal emails to
others, Or also  add a fileupload control for email attachments.




Other Related and Popular Articles :

Basics of XHTML-MP
Basics of XHTML-MP

181
181

Custom Validation for DOB Using three dropdownlist
This article is exactly usefull to validate date of Birth having three dropdownlist control.

Repeater within Repeater
this article is used to show hierarchical data using repeater control.

Introduction to Data Binding in ASP.NET 2.0
This article explains the basic concept about Data Binding in ASP.NET 2.0


Author Profile : kane nelson

Self paced learner i have been teaching myself ASP 2, .NET, AJAX, JAVASCRIPT & WEB DESIGN for 7+ years now. Ive moved to PHP, jquery and javascript for ease of use and overall support, Based in australia i am now working for the Victorian government as a software developer, system support officer and tech support analyst.
BORN Jan 1st 1974 im 36 years young and love working on a range of applications and many programming languages, developer of MANY and a MASTER of NONE !! hahaha *smiles*
*He whom thinks he has mastered all, is only a mastered man ! *

Click here to view Author Profile


How would you rate the quality of this content?
Poor Excellent

Comments

#How to Handle Printer Event using Background Service
27 Jan 2010 6:41 by : ramanathan

I have a requirement in ASP.NET, How can we handle printer functions (Who is printing, What is printing, when is printing,)..... the printers will be in different location in the network(Printers connected to System and Network printer) and we have to update the printer functions in a DB... and show the information in a Web enabled Solution..... For updating the info into DB shall be in any language.... the main issue here is i should install the service in only in one system that system should pass all the printer info to DB. Is it Possible..... Please any one can advise me.........

Leave New Comments


Article Content copyright by kane nelson
Everything else Copyright © by WorldofASP.NET 2010

Category
.NET 3.5
AJAX and ATLAS
ASP.NET
C# Programming
Classic ASP
Enterprise Systems
General .NET
VB.NET Programming
Announcements
Earn Cash by writing an article or review
For more info Click here







Legend : - Within 3 Days - Within 6 Days - Within 9 Days

Home | Add Resources | Sponsored Listings | Advertise with Us | SiteMap 1 | SiteMap 2 | Link To Us | Contact Us
© 2002-2010 Worldofasp.net ASP.NET Directory, Hosting and Tutorials | All rights reserved
Our Partners : ASP.NET Web Hosting | ASP Hosting | ASP.NET Hosting | Phone Card | Calling Card |Stock Investing