protected void Page_Load(object sender, EventArgs e)
    {
        RegisterESCScript = false;

        clientId = QueryHelper.GetString("clientid", "");

        SetTitle("CMSModules/CMS_DocumentLibrary/Properties.png", GetString("conditionbuilder.title"), "macros_rule_designer", "helpTopic");

        btnInsert.Click += new EventHandler(btnInsert_Click);

        designerElem.RuleCategoryNames = QueryHelper.GetString("module", "");
        designerElem.DisplayRuleType   = QueryHelper.GetInteger("ruletype", 0);

        // Set correct  resolver to the control
        string resolverName = ValidationHelper.GetString(SessionHelper.GetValue("ConditionBuilderResolver" + clientId), "");

        if (!string.IsNullOrEmpty(resolverName))
        {
            designerElem.ResolverName = resolverName;
        }

        if (!RequestHelper.IsPostBack())
        {
            string condition = MacroResolver.RemoveDataMacroBrackets(ValidationHelper.GetString(SessionHelper.GetValue("ConditionBuilderCondition" + clientId), ""));
            designerElem.Value = condition;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RegisterESCScript = false;

        this.CurrentMaster.Title.TitleText  = GetString("conditionbuilder.title");
        this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_DocumentLibrary/Properties.png");

        this.btnInsert.Click += new EventHandler(btnInsert_Click);

        if (!RequestHelper.IsPostBack())
        {
            string condition = MacroResolver.RemoveDataMacroBrackets(QueryHelper.GetString("condition", ""));
            this.designerElem.Condition = condition;
        }
    }
    /// <summary>
    /// Called when Insert button is clicked - sends selected control info back to the CK editor.
    /// </summary>
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        string macroValue = MacroResolver.RemoveDataMacroBrackets(macroEditor.Text.Trim());

        ScriptHelper.RegisterStartupScript(this, typeof(string), "InsertMacro", String.Format("InsertMacro('{0}');", ScriptHelper.GetString(macroValue, false)), true);
    }