示例#1
0
        /*
         * private void LoadDataAndDataBind(string sortExpression)
         * {
         *  DataView view = DataSource.Expression.DefaultView;
         *  view.Sort = sortExpression;
         *  MyListView.DataSource = view;
         *  MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("ExpressionId");
         *  MyListView.DataBind();
         * }
         * */

        /// <summary>
        /// Handles the ItemCommand event of the RulesList control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
        protected void RulesList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (String.Compare(e.CommandName, "DeleteExpression", StringComparison.OrdinalIgnoreCase) == 0)
            {
                //Notify RuleEditDialog for deletetion expression

                // delete expression
                int exprId = 0;
                if (Int32.TryParse(e.CommandArgument.ToString(), out exprId))
                {
                    if (_expression != null)
                    {
                        ExpressionDto.ExpressionRow expressionRow = _expression.Expression.FindByExpressionId(exprId);
                        if (expressionRow != null)
                        {
                            expressionRow.Delete();
                        }
                    }
                }

                //Delete corresponding FilterExpressionNodeCollection from list serialized collection
                ExpressionFilters.RemoveAt(e.Item.ItemIndex);
            }
            RulesList.DataSource = _expression;
            RulesList.DataBind();
            ExpressionsPanel.Update();
        }
示例#2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            CommandManager cm = CommandManager.GetCurrent(this.Page);

            cm.AddCommand("", "Marketing", "RulesEditor", "cmdShowRulesEditorDialog");
            cm.AddCommand("", "Marketing", "RulesEditor", "cmdShowRulesEditorDialogEdit");
            cm.AddCommand("", "Marketing", "RulesEditor", _RuleEditCommandString);

            if (!IsPostBack)
            {
                ExpressionFilters = LoadSerializedFilters();
            }
            ExpressionsPanel.Update();

            /*
             * if (!IsPostBack || String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0)
             *  LoadDataAndDataBind(String.Empty);
             * */
        }