1 / 13

Creating & Deploying ASP.Net WebPart in MOSS 2007

Creating & Deploying ASP.Net WebPart in MOSS 2007. Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft SQL Server MCTS Web Development MCP. Web Parts Overview.

Download Presentation

Creating & Deploying ASP.Net WebPart in MOSS 2007

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating & Deploying ASP.Net WebPart in MOSS 2007 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft SQL Server MCTS Web Development MCP

  2. Web Parts Overview • Web Parts is a framework built into ASP.NET 2.0 for building highly customizable portal-style pages. • Content designed to modular, consistent and easy to navigate • Web Parts add in support for customization and personalization

  3. Web Part History • Windows SharePoint Services 2.0 (WSS) • Designed with its own Web Part infrastructure • WSS serializes/stores/retrieves personalization data • ASP.NET 2.0 • Designed with newer universal Web Part infrastructure • Serializes/stores/retrieves personalization data • More flexible and more extensible than WSS • ASP.NET 2.0 does not support WSS v2 Web Parts • Windows SharePoint Services 3.0 (WSS) • Backward-compatible with v2 Web Parts • Offers a layer on top of the ASP.NET 2.0 Web Part infrastructure

  4. Web Part Types for WSS v3 ASP.NET 2.0 Runtime WSS v3 Runtime WSS Web Parts ASP Web Parts ASP Web Parts Hybrid Web Parts WSS v2 Runtime WSS Web Parts WSS Web Parts

  5. SPWebPartManager SPWebPartZone (Left) SPWebPartZone (Right) Editor Zone Web Part 1 Web Part 3 Editor Part 1 Web Part 2 Web Part 4 Editor Part 2 Web Part 5 Catalog Zone Catalog Part 1 Catalog Part 2 WSS v3 Web Part Page Structure

  6. Web Part - Example • The Web Part title bar contains the heading for the Web Part. • The Web Part title bar contains the heading for the Web Part. • The Web Part menu contains functions that enable you to minimize or close the Web Part, edit the Web Part, or get Help for a specific Web Part. • The body of the Web Part contains the content that you specified for the type of Web Part that is being used. In this example, the Web Part is an Image Web Part, which displays an image.

  7. Developing a WSS 3.0 Web Part • Web Parts derive from ASP.NET 2.0 WebPart base class using System; using System.Web.UI; using System.Web.UI.WebControls.WebParts; namespace MyWebParts { public class HelloWorldWebPart : WebPart { protected override void OnPreRender(EventArgs e) { this.Title = “Hello Web Part"; } protected override void RenderContents(HtmlTextWriter writer) { writer.Write("Hello, world"); } } }

  8. Deployment Steps • Deploy the .NET assembly • As private assembly in the \bin folder • As shared assembly in the Global Assembly Cache (GAC) • Register the Web Part as a safe control • Add the Web Part to the Web Part gallery available at the site collection level • Advertise the Web Part in the ‘Add Web Part’ dialog

  9. Web Part as a Safe Control • Web Parts usually run on Web Part Pages • Web Parts must be registered as Safe in web.config file • You must add entry to web.config before testing a Web Part <!– web.config in root directory of hosting virtual server --> <configuration> <SharePoint> <SafeControls> <SafeControlAssembly="AcmeWebParts" Namespace="AcmeWebParts" TypeName="*" Safe="True"/> </SafeControls> </SharePoint> </configuration>

  10. Manifest File • The application manifest is an XML file that: • Uniquely identifies the application • Describes dependencies on specific versions of side-by-side assemblies • http://msdn2.microsoft.com/en-us/library/ms766454.aspx

  11. Manifest File (con.) <?xml version="1.0" encoding="utf-8" ?> <!-- You need only one manifest per CAB project for Web Part Deployment.--> <!-- This manifest file can have multiple assembly nodes.--> <WebPartManifest xmlns="http://schemas.microsoft.com/WebPart/v2/Manifest"> <Assemblies> <Assembly FileName="demo.dll"> <!-- Use the <ClassResource> tag to specify resources like image files or Microsoft JScript files that your Web Parts use. --> <!-- Note that you must use relative paths when specifying resource files. --> <ClassResources></ClassResources> <SafeControls> <SafeControl Namespace="DemoWebPart" TypeName="*" /> </SafeControls> </Assembly> </Assemblies> <DwpFiles> <DwpFile FileName="DemoWebPart.WebPart"/> </DwpFiles> </WebPartManifest>

  12. Demo

  13. Resources & Questions • Microsoft Resources: - msdn.microsoft.com/sqlserver/ - www.microsoft.com/sql/community • Contact me: -tghazali@sqlmvp.com • Download Presentation : -www.sqlmvp.com

More Related