I wrote a webform applicaion with Visual Studio to keep track of customers on my database for website. My goal is that when the customer submits the information by hitting the submit button -- the database gets filled witht he customer info and the data
then gets emailed to my address. -- I know there are ways to do this with HTML forms but I did not write this form with HTML. Any help is appreciated!
//execute the query against the database
System.Data.OleDb.OleDbCommand ocmd =
new System.Data.OleDb.OleDbCommand(query,
new System.Data.OleDb.OleDbConnection(CSTR));
I did check this out but I ran into problems with the webconfig file as well as pulling the info from the dropdownmenus. Here is my html and web config also I was unsure about setting up the to and from. I need the to: address to be constant and the from
address will vary
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style4">The Run Around Inc. Team Order Form<br />
Please Excuse our appearance while we update our page!</span></div>
<td></td><img alt="" src="logo.jpg" style="width: 290px; height: 91px" /></td><table class="style1">
<tr>
<td class="style2">
Name
<td class="style3">
</td>
</tr>
<tr>
<td class="style2">
First
</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Please Provide Your First Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Last
</td>
<td class="style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Please Provide Your Last Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
E-Mail Address</td>
<td class="style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Please Provide Your E-Mail"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Phone Number</td>
<td class="style3">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TextBox4" ErrorMessage="Please Provide Your Phone Number"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Organization\Team Name</td>
<td class="style3">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox5"
ErrorMessage="Please Provide Your Organization or Team"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Type of Garment</td>
<td class="style3">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="TextBox6"
ErrorMessage="Please Provide the Garment Type You Are Interested In"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2" rowspan="2">
Garment Color<br />
(If color is not listed type color here)</td>
<td class="style3">
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="AccessDataSource1" DataTextField="GColor"
DataValueField="GColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="DropDownList1" ErrorMessage="Please Select a Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [GColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style3">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
Decoration Type</td>
<td class="style3">
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="AccessDataSource2" DataTextField="DType"
DataValueField="DType" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ControlToValidate="DropDownList2" ErrorMessage="Please Select Decoration Type"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DType] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Color</td>
<td class="style3">
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="AccessDataSource3" DataTextField="DColor"
DataValueField="DColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ControlToValidate="DropDownList3" ErrorMessage="Please Select Decoration Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Location</td>
<td class="style3">
<asp:DropDownList ID="DropDownList4" runat="server"
DataSourceID="AccessDataSource4" DataTextField="Location"
DataValueField="Location" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ControlToValidate="DropDownList4"
ErrorMessage="Please Select Decoration Location"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/TeamOrdering.mdb"
SelectCommand="SELECT [Location] FROM [TeamOrder]"></asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Please Provide a brief description with details of what you would prefer for you
artwork and\or design. (Ex. Names, Numbers, Artwork etc...)<br />
</td>
<td class="style3">
<asp:TextBox ID="TextBox8" runat="server" Height="124px" Width="306px"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server"
ControlToValidate="TextBox8" ErrorMessage="Please Provide Additional Details"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Quantity</td>
<td class="style3">
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ControlToValidate="TextBox9" ErrorMessage="Please Provide Quantity"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Button ID="ButtonSub" runat="server" Text="Submit"
onclick="ButtonSub_Click1" style="height: 26px" />
<asp:Button ID="ButtonClear" runat="server" onclick="ButtonClear_Click"
Text="Clear Form" />
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Label ID="Label1" runat="server"
style="font-size: medium; font-weight: 700; font-style: italic"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>
Web Config
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" urlLinePragmas="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
I am unsure as to where to add the controls for the systems.net to the webconfig -- also I am unsure how to email information from multiple text boxes and dropdownlists. All of the examples I have seen have only had to, from, and body.
Thanks for the help. I took your advice and added the code to the web.config file. The program wouldn't compile. So I removed the code and it still won't compile. Oh well. I guess I'll have to start over again. I tried making a new page with a new
form application and the new one won't compile either.
i) first make the email programme working.leave body blank.
ii)If everything fine then start adding control value one by one.
Take string builder
in string builder concatenate everythnig you want in body part
stringbuilder str1=<b>Name :</b>"+ txtbox1.Text +"<br><b>Phone</b> :"+textbox2.text +"
and so on.finally add string builder variable to body.
If adding the smtp settings to the web.config didn't work maybe your server doesn't support the system.net.mail name space. You might try the older web.mail name space and see if that works. Here is a quick example of how you would write it out:
jhartss
Member
6 Points
26 Posts
emailing textbox data
Nov 08, 2010 05:39 PM|LINK
Hello,
I wrote a webform applicaion with Visual Studio to keep track of customers on my database for website. My goal is that when the customer submits the information by hitting the submit button -- the database gets filled witht he customer info and the data then gets emailed to my address. -- I know there are ways to do this with HTML forms but I did not write this form with HTML. Any help is appreciated!
Here is my code
public partial class team : System.Web.UI.Page
{
static string CSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
AppDomain.CurrentDomain.BaseDirectory + "TeamOrdering.mdb";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ButtonClear_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
}
protected void ButtonSub_Click1(object sender, EventArgs e)
{
string fname = TextBox1.Text;
string lname = TextBox2.Text;
string email = TextBox3.Text;
string phone = TextBox4.Text;
string orgTeam = TextBox5.Text;
string type = TextBox6.Text;
string gcolor = DropDownList1.SelectedValue;
string altcolor = TextBox7.Text;
string dectype = DropDownList2.SelectedValue;
string decColor = DropDownList3.SelectedValue;
string decLoc = DropDownList4.SelectedValue;
string memo = TextBox8.Text;
string quantity = TextBox9.Text;
string query = "INSERT INTO NewTeamOrder (FName, LName, EMail, Phone, OrgTeam, GType, GColor, AltColor, DType, DColor, Location, Details, Quantity)" +
"VALUES (@FNValue, @LNValue ,@EMailValue, @PhoneValue, @orgTeamValue, @TypeValue, @GColorValue, @AltColorValue, @DecTypeValue, @DecColorValue, @DecLocValue, @MemoValue, @QtyValue)";
//execute the query against the database
System.Data.OleDb.OleDbCommand ocmd =
new System.Data.OleDb.OleDbCommand(query,
new System.Data.OleDb.OleDbConnection(CSTR));
ocmd.Parameters.AddWithValue("@FNValue", fname);
ocmd.Parameters.AddWithValue("@LNValue", lname);
ocmd.Parameters.AddWithValue("@EMailValue", email);
ocmd.Parameters.AddWithValue("@PhoneValue", phone);
ocmd.Parameters.AddWithValue("@orgTeamValue", orgTeam);
ocmd.Parameters.AddWithValue("@TypeValue", type);
ocmd.Parameters.AddWithValue("@GColorValue", gcolor);
ocmd.Parameters.AddWithValue("@AltColorValue", altcolor);
ocmd.Parameters.AddWithValue("@DecTypeValue", dectype);
ocmd.Parameters.AddWithValue("@DecColorValue", decColor);
ocmd.Parameters.AddWithValue("@DecLocValue", decLoc);
ocmd.Parameters.AddWithValue("@MemoValue", memo);
ocmd.Parameters.AddWithValue("@QtyValue", quantity);
ocmd.Connection.Open();
ocmd.ExecuteNonQuery();
ocmd.Connection.Close();
Label1.Text = "You have successfully submitted your quote";
}
}
TextBox emaill emailing data from textboxes
TabAlleman
All-Star
15571 Points
2700 Posts
Re: emailing textbox data
Nov 08, 2010 06:26 PM|LINK
http://www.4guysfromrolla.com/articles/072606-1.aspx
jhartss
Member
6 Points
26 Posts
Re: emailing textbox data
Nov 08, 2010 06:49 PM|LINK
Thanks!!
I did check this out but I ran into problems with the webconfig file as well as pulling the info from the dropdownmenus. Here is my html and web config also I was unsure about setting up the to and from. I need the to: address to be constant and the from address will vary
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Team Order Form</title>
<style type="text/css">
.style1
{
border-style: outset;
width: 57%;
background-color: #0000FF;
height: 779px;
color: #FFFF00;
}
.style2
{
width: 169px;
}
.style3
{
width: 433px;
}
.style4
{
font-size: large;
font-weight: bold;
font-style: italic;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style4">The Run Around Inc. Team Order Form<br />
Please Excuse our appearance while we update our page!</span></div>
<td></td><img alt="" src="logo.jpg" style="width: 290px; height: 91px" /></td><table class="style1">
<tr>
<td class="style2">
Name
<td class="style3">
</td>
</tr>
<tr>
<td class="style2">
First
</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Please Provide Your First Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Last
</td>
<td class="style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Please Provide Your Last Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
E-Mail Address</td>
<td class="style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Please Provide Your E-Mail"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Phone Number</td>
<td class="style3">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TextBox4" ErrorMessage="Please Provide Your Phone Number"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Organization\Team Name</td>
<td class="style3">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox5"
ErrorMessage="Please Provide Your Organization or Team"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Type of Garment</td>
<td class="style3">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="TextBox6"
ErrorMessage="Please Provide the Garment Type You Are Interested In"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2" rowspan="2">
Garment Color<br />
(If color is not listed type color here)</td>
<td class="style3">
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="AccessDataSource1" DataTextField="GColor"
DataValueField="GColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="DropDownList1" ErrorMessage="Please Select a Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [GColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style3">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
Decoration Type</td>
<td class="style3">
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="AccessDataSource2" DataTextField="DType"
DataValueField="DType" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ControlToValidate="DropDownList2" ErrorMessage="Please Select Decoration Type"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DType] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Color</td>
<td class="style3">
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="AccessDataSource3" DataTextField="DColor"
DataValueField="DColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ControlToValidate="DropDownList3" ErrorMessage="Please Select Decoration Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Location</td>
<td class="style3">
<asp:DropDownList ID="DropDownList4" runat="server"
DataSourceID="AccessDataSource4" DataTextField="Location"
DataValueField="Location" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ControlToValidate="DropDownList4"
ErrorMessage="Please Select Decoration Location"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/TeamOrdering.mdb"
SelectCommand="SELECT [Location] FROM [TeamOrder]"></asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Please Provide a brief description with details of what you would prefer for you
artwork and\or design. (Ex. Names, Numbers, Artwork etc...)<br />
</td>
<td class="style3">
<asp:TextBox ID="TextBox8" runat="server" Height="124px" Width="306px"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server"
ControlToValidate="TextBox8" ErrorMessage="Please Provide Additional Details"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Quantity</td>
<td class="style3">
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ControlToValidate="TextBox9" ErrorMessage="Please Provide Quantity"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Button ID="ButtonSub" runat="server" Text="Submit"
onclick="ButtonSub_Click1" style="height: 26px" />
<asp:Button ID="ButtonClear" runat="server" onclick="ButtonClear_Click"
Text="Clear Form" />
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Label ID="Label1" runat="server"
style="font-size: medium; font-weight: 700; font-style: italic"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>
Web Config
<!--
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;" id="_mcePaste"><html xmlns="http://www.w3.org/1999/xhtml">Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" urlLinePragmas="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/></compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></handlers></system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>
<head runat="server">
<title>Team Order Form</title>
<style type="text/css">
.style1
{
border-style: outset;
width: 57%;
background-color: #0000FF;
height: 779px;
color: #FFFF00;
}
.style2
{
width: 169px;
}
.style3
{
width: 433px;
}
.style4
{
font-size: large;
font-weight: bold;
font-style: italic;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style4">The Run Around Inc. Team Order Form<br />
Please Excuse our appearance while we update our page!</span></div>
<td></td><img alt="" src="logo.jpg" style="width: 290px; height: 91px" /></td><table class="style1">
<tr>
<td class="style2">
Name
<td class="style3">
</td>
</tr>
<tr>
<td class="style2">
First
</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Please Provide Your First Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Last
</td>
<td class="style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Please Provide Your Last Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
E-Mail Address</td>
<td class="style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Please Provide Your E-Mail"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Phone Number</td>
<td class="style3">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TextBox4" ErrorMessage="Please Provide Your Phone Number"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Organization\Team Name</td>
<td class="style3">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox5"
ErrorMessage="Please Provide Your Organization or Team"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Type of Garment</td>
<td class="style3">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="TextBox6"
ErrorMessage="Please Provide the Garment Type You Are Interested In"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2" rowspan="2">
Garment Color<br />
(If color is not listed type color here)</td>
<td class="style3">
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="AccessDataSource1" DataTextField="GColor"
DataValueField="GColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="DropDownList1" ErrorMessage="Please Select a Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [GColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style3">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
Decoration Type</td>
<td class="style3">
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="AccessDataSource2" DataTextField="DType"
DataValueField="DType" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ControlToValidate="DropDownList2" ErrorMessage="Please Select Decoration Type"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DType] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Color</td>
<td class="style3">
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="AccessDataSource3" DataTextField="DColor"
DataValueField="DColor" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ControlToValidate="DropDownList3" ErrorMessage="Please Select Decoration Color"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/TeamOrdering.mdb" SelectCommand="SELECT [DColor] FROM [TeamOrder]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Decoration Location</td>
<td class="style3">
<asp:DropDownList ID="DropDownList4" runat="server"
DataSourceID="AccessDataSource4" DataTextField="Location"
DataValueField="Location" AutoPostBack="True">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ControlToValidate="DropDownList4"
ErrorMessage="Please Select Decoration Location"></asp:RequiredFieldValidator>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/TeamOrdering.mdb"
SelectCommand="SELECT [Location] FROM [TeamOrder]"></asp:AccessDataSource>
</td>
</tr>
<tr>
<td class="style2">
Please Provide a brief description with details of what you would prefer for you
artwork and\or design. (Ex. Names, Numbers, Artwork etc...)<br />
</td>
<td class="style3">
<asp:TextBox ID="TextBox8" runat="server" Height="124px" Width="306px"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server"
ControlToValidate="TextBox8" ErrorMessage="Please Provide Additional Details"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Quantity</td>
<td class="style3">
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ControlToValidate="TextBox9" ErrorMessage="Please Provide Quantity"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Button ID="ButtonSub" runat="server" Text="Submit"
onclick="ButtonSub_Click1" style="height: 26px" />
<asp:Button ID="ButtonClear" runat="server" onclick="ButtonClear_Click"
Text="Clear Form" />
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style3">
<asp:Label ID="Label1" runat="server"
style="font-size: medium; font-weight: 700; font-style: italic"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>
</div>
TabAlleman
All-Star
15571 Points
2700 Posts
Re: emailing textbox data
Nov 08, 2010 07:52 PM|LINK
Can you be more specific about what is the problem you are having? That is too much code for me to go through looking for problems without guidance.
jhartss
Member
6 Points
26 Posts
Re: emailing textbox data
Nov 08, 2010 08:27 PM|LINK
I am unsure as to where to add the controls for the systems.net to the webconfig -- also I am unsure how to email information from multiple text boxes and dropdownlists. All of the examples I have seen have only had to, from, and body.
Thanks
TabAlleman
All-Star
15571 Points
2700 Posts
Re: emailing textbox data
Nov 08, 2010 08:51 PM|LINK
Regarding the web.config, I don't know how to be any more clear than the article already is:
To use the
element that contains an element whose settings are specified within its child element, like so:Web.configapproach, add a<system.net>element within the<configuration>element. Then, add a<configuration> <!-- Add the email settings to the <system.net> element --> <system.net> <mailSettings> <smtp> <network host="relayServerHostname" port="portNumber" userName="username" password="password" /> </smtp> </mailSettings> </system.net> <system.web> ... </system.web> </configuration>etc.
regarding multiple textboxes, etc, you would just do string concatenation, like:
strBody = txtbox1.Text + txtbox2.Text + dropdownlist1.SelectedValue.ToString()
etc.
jhartss
Member
6 Points
26 Posts
Re: emailing textbox data
Nov 08, 2010 10:52 PM|LINK
Thanks for the help. I took your advice and added the code to the web.config file. The program wouldn't compile. So I removed the code and it still won't compile. Oh well. I guess I'll have to start over again. I tried making a new page with a new form application and the new one won't compile either.
TabAlleman
All-Star
15571 Points
2700 Posts
Re: emailing textbox data
Nov 09, 2010 01:13 PM|LINK
does it give you an error message saying why it won't compile?
KumarHarsh
All-Star
15133 Points
3647 Posts
Re: emailing textbox data
Nov 10, 2010 11:25 AM|LINK
i) first make the email programme working.leave body blank.
ii)If everything fine then start adding control value one by one.
Take string builder
in string builder concatenate everythnig you want in body part
stringbuilder str1=<b>Name :</b>"+ txtbox1.Text +"<br><b>Phone</b> :"+textbox2.text +"
and so on.finally add string builder variable to body.
Body =str1
print exact error message,if any error.
Kumar Harsh
aalexander
Member
121 Points
29 Posts
Re: emailing textbox data
Nov 11, 2010 07:28 PM|LINK
If adding the smtp settings to the web.config didn't work maybe your server doesn't support the system.net.mail name space. You might try the older web.mail name space and see if that works. Here is a quick example of how you would write it out:
MailMessage objMM = new MailMessage();
objMM.To = "you@domain.com";
objMM.From = txtemail.Text;
objMM.BodyFormat = MailFormat.Text;
objMM.Subject = "Address Update Form";
objMM.Body = "At " + DateTime.Now + ":\r\n" + txtlname.Text + ", " + txtfname.Text + " sent "
+ "this email to update his or her address.\r\n"
+ "---------------------------------------------------------\r\n"
+ "First Name: " + txtfname.Text + "\r\n"
+ "Middle Name: " + txtmname.Text + "\r\n"
+ "Last Name: " + txtlname.Text + "\r\n"
+ "Maiden Name: " + txtmaiden_name.Text + "\r\n"
+ "Street 1: " + txtstreet1.Text + "\r\n"
+ "Street 2: " + txtstreet2.Text + "\r\n"
+ "City, State: " + txtcity.Text + ", " + lststate.Value + "\r\n"
+ "Zip: " + txtzip.Text + "\r\n"
+ "Phone: " + txtphone.Text + "\r\n"
+ "Email: " + txtemail.Text + "\r\n"
+ "Year(s) Attended: " + txtyears.Text + "\r\n"
+ "Degree/Certificate: " + txtdegree.Text + "\r\n"
+ "Occupation: " + txtoccupation.Text + "\r\n"
+ "Employer: " + txtemployer.Text + "\r\n"
+ "Affiliation: " + straffiliation + "\r\n"
+ "Comments: " + txtcomments.Value + "\r\n";
SmtpMail.SmtpServer = "exchangeserver";
SmtpMail.Send(objMM);
here is an example for the system.net.mail http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
here is an example for the system.web.mail http://support.microsoft.com/kb/310273