ASP.Net/Components/Contact Page — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:51, 26 мая 2010
Contact Page (VB.net)
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script runat=server>
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
Dim DBConn as OleDbConnection
Dim DBAdd As New OleDbCommand
DBConn = New OleDbConnection( _
"PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath _
("ContactDB.mdb;"))
DBAdd.rumandText = "Insert Into Contacts " _
& "(ContactName, ContactEmail, Topic, " _
& "TheMessage, DateTimeEntered) values (" _
& """ & Replace(txtContactName.Text, """, """") _
& "", " _
& """ & Replace(txtContactEmail.Text, """, """") _
& "", " _
& """ & ddlTopic.SelectedItem.Text & "", " _
& """ & Replace(txtTheMessage.Text, """, """") _
& "", Now)"
DBAdd.Connection = DBConn
DBAdd.Connection.Open
DBAdd.ExecuteNonQuery()
lblMessage.Text = "Your request has been submitted."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Contact Us Page</TITLE>
</HEAD>
<form runat="server">
<asp:Label
id="lblMessage"
Font-Size="12pt"
Font-Name="Tahoma"
runat="server"
Text="Complete each field to submit your communication."
/>
<P></P><Font Face="Tahoma">Your Name:</Font><BR>
<asp:textbox
id="txtContactName"
columns="25"
maxlength="50"
runat=server
/>
<asp:requiredfieldvalidator
id="rfvContactName"
controltovalidate="txtContactName"
display="Dynamic"
font-name="Tahoma"
font-size="10pt"
runat=server>
User Name is Required!
</asp:RequiredFieldValidator>
<P></P><Font Face="Tahoma">Your Email:</Font><BR>
<asp:textbox
id="txtContactEmail"
columns="25"
maxlength="50"
runat=server
/>
<asp:requiredfieldvalidator
id="rfvContactEmail"
controltovalidate="txtContactEmail"
display="Dynamic"
font-name="Tahoma"
font-size="10pt"
runat=server>
User Name is Required!
</asp:RequiredFieldValidator>
<P></P><Font Face="Tahoma">Select Topic:</Font><BR>
<asp:dropdownlist
id="ddlTopic"
runat=server
>
<asp:listitem>Web Site</asp:listitem>
<asp:listitem>Order Status</asp:listitem>
<asp:listitem>Other</asp:listitem>
</asp:dropdownlist>
<P></P><Font Face="Tahoma">Your Message:</Font><BR>
<asp:textbox
id="txtTheMessage"
columns="25"
rows=5
textmode="multiline"
runat=server
/>
<BR><BR>
<asp:button
id="butOK"
text=" OK "
OnClick="SubmitBtn_Click"
runat="server"
/>
</form>
</BODY>
</HTML>
<A href="http://www.nfex.ru/Code/ASPDownload/ContactDB.zip">ContactDB.zip( 8 k)</a>