Building the Presentation Layer
The Web Part needs to override methods provided by the SharePoint Framework in order to ‘hook in’ to the page request. This custom code will then be executed, and will call our GetListing()
method to connect to MCMS and generate the XML file of the channel items. After that, the page and sub-channel listing will be displayed.
The chart below shows an overview of how our code will work:
As we are building the Web Part as a server control, we must declare our controls and instantiate them by overriding the CreateChildControls
method in NavigationWebPart.cs
:
#region declarations - Web controls protected System.Web.UI.WebControls.Xml XmlXslWebControl; #endregion #region Preparing the controls protected override void CreateChildControls() { XmlXslWebControl = new System.Web.UI.WebControls.Xml(); this.Controls.Add(XmlXslWebControl); } #endregion
The System.Web.UI.WebControls.Xml
Web Control can transform XML using specified XSLT, which is more efficient...