Пример #1
0
 internal virtual void OnValidation(RemoteValidationEventArgs e)
 {
     if (this.Handler != null)
     {
         this.Handler(this.Owner, e);
     }
 }
Пример #2
0
        public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams)
        {
            bool   success = true;
            string message = null;
            object value   = null;

            try
            {
                if (eventArgument.IsEmpty())
                {
                    throw new ArgumentNullException("eventArgument");
                }

                XmlNode xmlData = this.SubmitConfig;
                string  data    = null;

                if (xmlData != null)
                {
                    XmlNode serviceNode = xmlData.SelectSingleNode("config/serviceParams");

                    if (serviceNode != null)
                    {
                        data = serviceNode.InnerText;
                    }
                }

                switch (eventArgument)
                {
                case "remotevalidation":
                    RemoteValidationEventArgs e = new RemoteValidationEventArgs(data, extraParams);
                    this.RemoteValidation.OnValidation(e);
                    success = e.Success;
                    message = e.ErrorMessage;
                    if (e.ValueIsChanged)
                    {
                        value = e.Value;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                success = false;
                message = this.IsDebugging ? ex.ToString() : ex.Message;

                if (this.ResourceManager.RethrowAjaxExceptions)
                {
                    throw;
                }
            }

            ResourceManager.ServiceResponse = new { valid = success, message, value };
        }