コード例 #1
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     // this grabs the From field of the sent message and puts it into the textbox for the To field of the outgoing message
     TextBox1.Text = GridView1.SelectedDataKey[1].ToString();
     // this focuses the cursor on the outgoing message body text area
     TextArea1.Focus();
 }
コード例 #2
0
        protected void sendMail_Click(object sender, EventArgs e)
        {
            if (Text1.Value == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a recipient email address" + "');", true);
                Text1.Focus();
            }
            else if (TextArea1.Value == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a non-empty message" + "');", true);
                TextArea1.Focus();
            }
            else if

            else
            {
                date = DateTime.Now.ToString("d");

                cmd.CommandText = "INSERT INTO Emails([fromUser],[toUser],[subject],[text],[date],[status],[deleted]) Values ('" + Session["user"].ToString() + "','" + Text1.Value.ToString() + "','" + Text3.Value.ToString() + "','" + TextArea1.Value + "','" + date + "','u','n');";
                cmd.ExecuteNonQuery();
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Your email has been sent." + "');", true);
                Response.Redirect("inbox.aspx");
            }
        }
コード例 #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        System.Web.UI.HtmlControls.HtmlTextArea htaDemo = (System.Web.UI.HtmlControls.HtmlTextArea)(TextArea1.FindControl("TextArea1"));
        string msg = htaDemo.Value;

        Label1.Text = msg;
    }