protected void Page_Load(object sender, EventArgs e) { ErrorMessageContainer.Visible = false; ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl(Button1); if (CurrentRule != null) { RuleName.Text = CurrentRule.RuleName; IsLeftRule = (CurrentRule.RuleDirection == Rule.Direction.Left); RuleDirectionLiteral.Text = _ruleDirection.ToString(); } else if (!string.IsNullOrEmpty(RuleName.Text)) { CurrentRule = RuleEngine.Instance.GetRule(RuleName.Text); _ruleDirection = (Rule.Direction)Enum.Parse(typeof(Rule.Direction), RuleDirectionLiteral.Text); } if (_ruleDirection == Rule.Direction.Both) { // Rule direction not set - check page against rule IsLeftRule = RuleEngine.Instance.IsLeftRule(CurrentPage.PageLink.ID, CurrentRule); } if (IsLeftRule && !CurrentRule.RuleVisibleLeft || !IsLeftRule && !CurrentRule.RuleVisibleRight) { this.Visible = false; return; } if (!IsPostBack) { PerformSearch_Click(null, null); } string pageTypes = ""; if (IsLeftRule) { pageTypes = HttpUtility.UrlDecode(CurrentRule.PageTypeRight); } else { pageTypes = HttpUtility.UrlDecode(CurrentRule.PageTypeLeft); } if (!IsPostBack) { if (pageTypes.Split(';').Length > 2) { PageTypesDropDown.DataSource = pageTypes.Split(';'); PageTypesDropDown.DataBind(); PageTypesContainer.Visible = true; PageTypesDropDown.SelectedIndex = PageTypesDropDown.Items.Count - 1; } } RelatedRelations.DataSource = GetRelationsForPage(CurrentPage.PageLink.ID, CurrentRule); RelatedRelations.DataBind(); }
private static string GetCacheKey(int pageid, string rule, Rule.Direction direction) { return("Relations-" + pageid + "-" + rule + "-" + direction.ToString()); }