예제 #1
0
        internal virtual void OnNodeLoad(NodeLoadEventArgs e)
        {
            NodeLoadEventHandler handler = (NodeLoadEventHandler)Events[EventNodeLoad];

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #2
0
        public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams)
        {
            bool               success = true;
            string             msg     = null;
            TreeNodeCollection nodes   = null;

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

                switch (eventArgument)
                {
                case "nodeload":
                    NodeLoadEventArgs e      = new NodeLoadEventArgs(extraParams);
                    PageTreeLoader    loader = (PageTreeLoader)this.Loader.Primary;
                    loader.OnNodeLoad(e);
                    nodes   = e.Nodes;
                    success = e.Success;
                    msg     = e.ErrorMessage;
                    break;
                }
            }
            catch (Exception ex)
            {
                success = false;
                msg     = this.IsDebugging ? ex.ToString() : ex.Message;
                if (this.ScriptManager.RethrowAjaxExceptions)
                {
                    throw;
                }
            }

            AfterAjaxEventArgs eAjaxPostBackResult = new AfterAjaxEventArgs(new Response(success, msg));

            eAjaxPostBackResult.Response.Data = nodes != null?nodes.ToJson() : null;

            ScriptManager.ServiceResponse = eAjaxPostBackResult.Response;
        }