Code Behind Page Page /ContactUs.aspx.cs (C#)
Used by Page /ContactUs.aspx (C#)
1: using System;  
2: using System.Data;  
3: using System.Configuration;  
4: using System.Collections;  
5: using System.Web;  
6: using System.Web.Security;  
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: using System.Data.SqlClient;  
12: using QuizNetOnline.Logic;  
13: using QuiznetOnline.Data;  
14: using Microsoft.ApplicationBlocks.Data;  
15:   
16: public partial class _ContactUs : QuiznetOnline.Web.UI.BusinessClasses.BasePage  
17: {  
18:     protected override void Page_Load(object sender, EventArgs e)  
19:     {  
20:         if (!Page.IsPostBack)  
21:         {  
22:             base.Page_Load(sender, e);  
23:         }  
24:     }  
25:   
26:     private void ClearFields()  
27:     {  
28:         txtName.Text = "";  
29:         txtEmail.Text = "";  
30:         txtSubject.Text = "";  
31:         txtMessage.Text = "";  
32:     }  
33:   
34:     protected void txtSend_Click(object sender, EventArgs e)  
35:     {  
36:         SqlCommand cmd = new SqlCommand();  
37:         QuizNetSystem quizNetSystem = new QuizNetSystem();  
38:         string Name, Email, Subject, Message;  
39:   
40:         Name = txtName.Text.ToString().Replace("'", "''");  
41:         Email = txtEmail.Text.ToString().Replace("'", "''");  
42:         Subject = txtSubject.Text.ToString().Replace("'", "''");  
43:         Message = txtMessage.Text.ToString().Replace("'", "''");  
44:   
45:         ContactUs contactUs = new ContactUs();  
46:   
47:         contactUs.Email = Email;  
48:         contactUs.Name = Name;  
49:         contactUs.Subject = Subject;  
50:         contactUs.Message = Message;  
51:   
52:         contactUs.Create(new SqlWrapper());  
53:   
54:         quizNetSystem.SendEmail("contact@quiznetonline.com", "Contact Us - " + Email + "-" + Subject, Message, false, false);  
55:         ClearFields();  
56:   
57:         Type cstype = this.GetType();  
58:         ClientScriptManager cs = Page.ClientScript;  
59:   
60:         // Check to see if the startup script is already registered.  
61:         if (!cs.IsStartupScriptRegistered(cstype, "clientScript"))  
62:         {  
63:             cs.RegisterStartupScript(cstype, "clientScript", "<script language='javascript'>ShowAlert()</script>", false);  
64:         }  
65:   
66:     }  
67: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.