Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How to add
Hi Biagio,
I used the snippet below to achieve this:
public void AddDashboard() { var saveFile = false; var dashboardPath = "~/config/Dashboard.config"; var dashboardFilePath = HostingEnvironment.MapPath(dashboardPath); XmlDocument dashboardXml = new XmlDocument(); if (dashboardFilePath != null) { dashboardXml.Load(dashboardFilePath); XmlNode findSection = dashboardXml.SelectSingleNode("//section [@alias='ErrorMonitorSection']"); if (findSection == null) { const string xmlToAdd = "<section alias='ErrorMonitorSection'>" + "<areas>" + "<area>developer</area>" + "</areas>" + "<tab caption='Error Monitor'>" + "<control addPanel='true' panelCaption=''>/App_Plugins/ErrorMonitor/views/errormonitor.dashboard.html</control>" + "</tab>" + "</section>"; XmlNode dashboardNode = dashboardXml.SelectSingleNode("//dashBoard"); if (dashboardNode != null) { XmlDocument xmlNodeToAdd = new XmlDocument(); xmlNodeToAdd.LoadXml(xmlToAdd); var toAdd = xmlNodeToAdd.SelectSingleNode("*"); if (dashboardNode.OwnerDocument != null) dashboardNode.AppendChild(dashboardNode.OwnerDocument.ImportNode(toAdd, true)); saveFile = true; } } if (saveFile) { dashboardXml.Save(dashboardFilePath); } } }
Hope that helps.
Paulius
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Dashboard.config: How to add <section> dinamically?
How to add
Hi Biagio,
I used the snippet below to achieve this:
Hope that helps.
Paulius
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.