Exemplo n.º 1
0
        /// <summary>
        /// Método acionado quando um item for alterado.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemUpdated(object sender, System.Web.UI.WebControls.DetailsViewUpdatedEventArgs e)
        {
            if (e.Exception == null && !string.IsNullOrEmpty(_successUrl))
            {
                System.Web.HttpContext.Current.Response.Redirect(_detailsView.ResolveUrl(_successUrl));
            }

            else if (e.Exception != null)
            {
                var validator = new BehaviorValidator();
                validator.IsValid = false;

                var exception = e.Exception;
                if (exception is System.Reflection.TargetInvocationException)
                {
                    exception = exception.InnerException;
                }

                validator.ErrorMessage = exception.Message;
                _detailsView.Page.Validators.Add(validator);

                e.ExceptionHandled = true;
                e.KeepInEditMode   = true;
            }
        }
Exemplo n.º 2
0
 protected void dvCustomerDetails_ItemUpdated(object sender, System.Web.UI.WebControls.DetailsViewUpdatedEventArgs e)
 {
     // Event Handler After update
     {
         Session["ssMessage"] = "Item Updated Successfully";
         Session["ssCCClass"] = "alert-success";
         //Asignar valor a las parametros del metodo WriteLogProc
         var strEvento = "ItemUpdated";
         var strTabla  = "Product";
         var strForma  = "ProductDetail";
         var struser   = Session["ssUsr"].ToString();
         // Call to the writeLogProc that executes the Stored Procedure Store.spINSERTLog
         WriteLogProc(struser, strEvento, strTabla, strForma);
     }
 }