public static void FormatPropertyControl(string name, ContentItem item, Control editor) { Label label = editor.FindControl("lbl" + name) as Label; Control container = label.Parent; //if (container.Controls.OfType<Control>().FirstOrDefault(x => x.ID == container.ID + "_hlInheritedPage") == null) //{ ContentItem inheritedFrom = item.HasInheritedDynamicValue(name); if (inheritedFrom == null || inheritedFrom == item) { label.ForeColor = Color.Green; label.ToolTip = "This property does not have an inherited value"; } else { label.ForeColor = Color.Red; HyperLink hyperlink = new HyperLink { NavigateUrl = Context.Current.ManagementPaths.GetEditExistingItemUrl(inheritedFrom) + "#Frame_Content_ie_Dynamic", ToolTip = "This property inherits its value from " + inheritedFrom.Title + " - #" + inheritedFrom.ID, }; hyperlink.ImageUrl = hyperlink.ResolveUrl("~/N2/Resources/icons/note.png"); int index = container.Controls.IndexOf(label); container.Controls.AddAt(index + 1, hyperlink); } //} }
void InitDialog(HyperLink lnk, object dataitem, string[] args) { if (args == null || args.Length < 1) { throw new SystemException("ActionField:参数不能小于1"); } string url = args[0]; string width = args.Length > 1 ? args[1] : "600"; string height = args.Length > 2 ? args[2] : "450"; MatchCollection mcc = regexField.Matches(url); foreach (Match m in mcc) { url = url.Replace(m.Value, GetValue(dataitem, m.Groups["field"].Value)); } lnk.Attributes["onclick"] = string.Format(OPENWINDOWN, lnk.ResolveUrl(url), width, height); lnk.NavigateUrl = "#"; }