Ejemplo n.º 1
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            if (ValidateInsertFields())
            {
                lblMessage.Text = "";
                try
                {
                    DS_Main.Insert();
                    lblMessage.Text = "Message was successfully added !!!";

                    ClearInsertFields();

                    string script = "<script type=\"text/javascript\">alert('Message was successfully added !!!');</script>";
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script);

                    BindData();
                }
                catch (Exception ex)
                {
                    lblMessage.Text = "Error: " + ex.Message;
                    string script = "<script type=\"text/javascript\">alert('Error: " + ex.Message + "');</script>";
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script);
                }
            }
        }
Ejemplo n.º 2
0
 protected void btAdd_Click(object sender, EventArgs e)
 {
     if (ValidateInsertFields())
     {
         lblMessage.Text = "";
         try
         {
             DS_Main.Insert();
             lblMessage.Text = "Message was successfully added !!!";
             ClearInsertFields();
             BindData();
         }
         catch (Exception ex)
         {
             lblMessage.Text = "Error: " + ex.Message;
         }
     }
 }