473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

e-mailing form data

i'm using asp.c# to validate form and e-mail the results to my inbox but keep getting this error message:
Compiler Error Message: CS0117: 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'Form1'

need some assistance, my aspx & C# code:

[HTML]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="join.aspx.cs" Inherits="join" %>

<form id="Form1" runat="server">
<label>Username:</label>
<asp:TextBox runat="server" ID="txtUsername" MaxLength="30"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvUsername" ControlToValidate="txtUsername" ErrorMessage="*Required"
runat="server"></asp:RequiredFieldValidator>
<div class="clear"></div>

<label>Password:</label>
<asp:TextBox runat="server" ID="txtPassword" MaxLength="30" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator id="rfvPassword" ControlToValidate="txtPassword" Display="Dynamic" ErrorMessage="*Required" runat="server">
</asp:RequiredFieldValidator>
<div class="clear"></div>
<label>Confirm Password:</label>
<asp:TextBox ID="txtConPass" MaxLength="30" TextMode="Password" runat="server"/>
<asp:RequiredFieldValidator id="rfvConPass" ControlToValidate="txtConPass" Display="Dynamic" ErrorMessage="*Required" runat="server">
</asp:RequiredFieldValidator>
<asp:CompareValidator id="PasswordCompareValidator" ControlToValidate="txtPassword" ControlToCompare="txtConPass" ErrorMessage="Passwords you entered did not match, please re-enter" Type="String" Operator="Equal" runat="server" />
<div class="clear"></div>

<label>Alien Race:</label>
<asp:TextBox runat="server" ID="txtAlienRace" MaxLength="40"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvAlienRace" ControlToValidate="txtAlienRace" ErrorMessage="*Required" runat="server"></asp:RequiredFieldValidator>
<div class="clear"></div>

<label>Galaxy:</label>
<asp:TextBox runat="server" ID="txtGalaxy" MaxLength="40"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvGalaxy" ControlToValidate="txtGalaxy" ErrorMessage="*Required" runat="server"></asp:RequiredFieldValidator>
<div class="clear"></div>

<label>Solar System:</label>
<asp:TextBox runat="server" ID="txtSolar" MaxLength="40"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvSolar" ControlToValidate="txtSolar" ErrorMessage="*Required" runat="server"></asp:RequiredFieldValidator>
<div class="clear"></div>

<label>Planet:</label>
<asp:TextBox runat="server" ID="txtPlanet" MaxLength="40"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPlanet" ControlToValidate="txtPlanet" ErrorMessage="*Required" runat="server"></asp:RequiredFieldValidator>
<div class="clear"></div>

<label>Email Address:</label>
<asp:TextBox runat="server" ID="txtEmail" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvEmail" ControlToValidate="txtEmail" ErrorMessage="*Required"
runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="rgxEmail" runat="server" ControlToValidate="txtEmail"
ValidationExpression="^\S+@\S+\.\S+$" ErrorMessage="*Invalid email address">
</asp:RegularExpressionValidator>
<div class="clear"></div>
<label>Confirm E-mail:</label>
<asp:TextBox ID="txtEmailCon" MaxLength="50" runat="server"/>
<asp:RequiredFieldValidator id="rfvEmailCon" ControlToValidate="txtEmailCon" Display="Dynamic" ErrorMessage="*Required" runat="server">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmailCon"
ValidationExpression="^\S+@\S+\.\S+$" ErrorMessage="*Invalid email address">
</asp:RegularExpressionValidator>
<asp:CompareValidator id="CompareValidator2" ControlToValidate="txtEmail" ControlToCompare="txtEmailCon" ErrorMessage="Email you entered did not match, please re-enter" Type="String" Operator="Equal" runat="server" />
<div class="clear"></div>

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit Application" CssClass="submitbutton"/>&nbsp;
</form>[/HTML]

Expand|Select|Wrap|Line Numbers
  1. lusing System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.Mail;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11.  
  12.  
  13. public partial class join : System.Web.UI.Page
  14. {
  15.  
  16.     private void Button1_Click(object sender, System.EventArgs e)
  17.     {
  18.  
  19.         MailMessage mail = new MailMessage();
  20.  
  21.         mail.To = "michael.pagan1@btinternet.com";
  22.  
  23.         mail.From = txtUsername.Text;
  24.  
  25.         mail.Subject = "Pagan Alliance Applicant";
  26.  
  27.         mail.Body = Form.Form1.Text;
  28.  
  29.         SmtpMail.SmtpServer = "localhost";
  30.  
  31.         SmtpMail.Send(mail);
  32.  
  33.     }
  34. }
Aug 19 '07 #1
0 1257

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
8
by: Du | last post by:
I'm trying to automate the upload process to yousendit.com, but the file size doesn't add up and yousendit.com keep rejecting my upload (it accepts the upload until the very end) I don't know...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
7
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem...
7
by: cover | last post by:
I have a form that writes to an MySQL database just fine but would like to email people to give them a heads up that an entry was made under their name (1 of 6 names on writing to the database). ...
0
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg...
4
by: pbd22 | last post by:
hi. could somebody tell me, when uploading a file, i know the form where the upload component is must have enctype=multipart/form-data but, is the same true for the form with the server code to...
2
by: Malli mindwave | last post by:
Hi, We are using the yahoowebHostiing service for my company website, In that one screen of the SendComments/FeedBack section is there, I'm basically dot.net develeoper ,but yahoowebhosting not...
1
by: starter08 | last post by:
Hi, I have a C++ routine(client-side) which uploads an xml file to a web server by making a socket connection and sending all the post request through that socket. On the server side I have a cgi...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.