Recently Viewed...
SnowCovered Top Sellers

Version 5 of the perennial best-selling tool for creating data-based solutions in DNN without custom programming. This version focuses on greater flexibility, expandability, and ease-of-use.

Live Content uses Web 2.0 approach to provide a Rich User Interface and streamlines content presentation by overlaying content on current page. Overlay images, videos, audio, text/html content, flash, dotnetnuke modules, and external content. Experience the demo...

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to add videos in various format and automatically convert them to flv format, you also can add videos from embed code and play them in our integrated flash video player.

Powerful, Ajax Enabled, Easy to Use. Document Management has never been better. Open-DocumentLibrary allows DotNetNuke users to share and manage documents in a flexible, intelligent way, offering granular control over Folder and Document access.

'Relationship Building' and 'Communication' are two essential nuts and bolts for a business to prosper. This module allows you to bridge both of these and easily generate continuous awareness of your web site, products and services. Your prospects and customers will greatly appreciate this featur

In this day and age, knowing as much detailed information as possible about your customer, prospect or web site user is essential. Thankfully, the new 'Dynamics Forms' module from Data Springs, makes it easier than ever to segment your data collection efforts.

Capture your users attention, enrich your site with multimedia flash, and create and opt in distribution list for your DNN site. These are just a few of the many features the Data Springs Module Collection can provide you.

Ultra Media Gallery is the most popular photo gallery and media gallery solution for DotNetNuke, UMG offers 10 different flash player to browse your gallery with completely different user interface experience.

The Catalyst skins are professionally designed, coded and packaged by a team of DotNetNuke experts. The skins are available in 12 great colours. This skin is easily customisable with our unique DrNuke EasyMod technology. Try our demo!

ALL NEW ! - Minimalist includes skin packs in 12 great colors. Each color has Flat, Gradient and Glass versions. Feature rich XML Flash header, perfect for just about any purpose. 9 Different menu options in each skin pack; 3 horizontal menus, 3 vertical menus and 3 all-new Twin level menus . . .

    |   Register   |   Thursday, November 20, 2008   
You are here:Resources  Articles & Information  Sharepoint 2007 Custom Web Parts  


Custom Web Parts for SharePoint Portal 2007

Developing and Deploying Custom Web Parts for SharePoint Portal 2007

 


Overview and difference with SPS 2003:

Developing Web Part for SharePoint Portal 2007 is different as compared to developing for SPS 2003. Web Parts Developed in .Net 1.1 for SPS 2003 used the SharePoint.WebPartPages namespace, however the Web Part in ASP.Net 2.0 is found under the System.Web.UI.WebControls.WebParts.

 

 

Development of Web Part in VS 2005

To Get Started with creating Custom Web Part for MOSS 2007 in Microsoft Visual Studio 2005, Open the IDE and create a new C# project, Select Class Library as Project Type. Name It as NewWebPart.

 

 

image001.jpg

 

Add a reference to the System.Web  from .Net components into the project. The System.Web dll contains the required namespace of System.Web.UI.WebControls.WebParts .

 

image003.jpg

 

 

 

In The Project explorer view rename the Class1.cs with NewWbPart.cs to be consistent with this example; this will result in renaming the Class name as well. With the help of “using” keyword include the namespaces as shown in the code example below. Derive / Extend the NewWebPart Class from the WebPart Class ( System.Web.UI.WebControls.WebParts.WebPart), and add the code as shown below. The CreateChildren Control is same as in .Net 1.1, that it would create and add controls to this Web Part Class,. In this case I have only added a WebControl.Calender Object. The RenderControl Method is an override for the WebPart Base Class and calls the RenderChildren Method, this causes the Children Controls to be rendered on the Particular HtmlTextWriter passed as a parameter to the method.

 


 

using System;

using System.Collections.Generic;

using System.Text;

 

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

 

namespace NewWepPart

{

    public class NewWebPart : WebPart

    {

 

        protected override void CreateChildControls()

        {

            Calendar cldr = new Calendar();

            cldr.Enabled = true;

            cldr.ShowGridLines = true;

            cldr.ShowTitle = true;

            cldr.EnableViewState = true;

      cldr.SelectedDate = DateTime.Now;

 

            Controls.Add(cldr);       �

          �

        }

 

        public override void RenderControl(HtmlTextWriter writer)

        {

 

            RenderChildren(writer);

        }

 

    }

}

 

 


 

Build the project and on successful built you are ready to Deploy the Web Part to the Portal Site.

 

Deployment of Web Part:

In order to deploy a web part to a SharePoint portal 2007 site, we must have the URL of the site to which we want our web part needs to be deployed (displayed in fact). As it  is mentioned earlier that the Web Parts developed in .Net 2.0 environment does have a .CAB project , instead an assembly is created on build of project. Now there are two choices to deploy the assembly to the SharePoint portal directory.

  • Deploy the assembly to the Assembly Folder (GAC) (requires the assembly to be stron named).
  • Put the assembly to the bin folder of the portal directory.

For the sake of simplicity, the later choice is being demonstrated in this example.


Putting Assembly in Bin Folder:

The MOSS 2007 creates every portal in the inetpub\wwwroot\wss folder. The easiest way to find the bin folder from these folder hierarchies is to go from inetmgr console. Locate the appropriate portal (for which u want to deploy the web part), identified with the port number. Right click and have Properties. Under the Home Directory Tab, note the path in Local path text box. Verify if the bin folder exists in the specified path by opening it in browser. If the folder doesn’t exist then create one. Now copy the assembly form the project output folder and paste it in bin folder of portal.

 

 

image004.png

However there is another work around for putting the assembly in to the portal’s bin folder again ad again each time the Web Part Project is built with changes.

Right click on the project name (NewWebPart) in the VS.Net 2005 IDE and click properties. Under  the Build page paste the same path copied from inetmgr console into the Output Path. As shown in figure below. This will result in the latest assembly automatically deployed to the bin folder every time the project is built.

 

image005.png

 

 

 

 

Adding the Safe Control Entry:

Even though the assembly is present in the Portal’s Bin folder, there is another step required to make the Control (Web Part) assembly usable on the Portal Pages. Since the control will need to render on multiple machines in different browsers with as many user accounts as the organizations have. There is a need to declare the control as “safe”. To do so open the web.config file placed under the portal’s directory in the VS.Net 2005 IDE.

 

image007.png

 

 

 

Then edit the file in the section of SafeControls, create a new SafeControl entry for our assembly as shown below. Save the file and close it.

 

 

<SafeControls>

.

.

.

<SafeControl Assembly="NewWebPart" Namespace="NewWebPart" TypeName="*" Safe="True" />

 

SafeControls>

  

Configuring Portal to use NewWebPart

Since now the web part have been written and deployed to the desired portal’s directory. The next task is to use the web part on the Portal’s Site. The Web Part Deployed to the portal can be placed on any site within that Portal. For convenience this NewWebPart is demonstrated to be placed on the home page of default Portal.

Open the portal site in the internet explorer; in this case http://oss1 is the URL for the default portal, ensuring that the current logged in user has the administrative rights on the portal site.

 

To begin with, the first step is to add the newly deployed web to the Portal’s web part gallery, since the portal is using the configuration databases to keep record of the contents of the portal, our newly created web part’s information doesn’t exist in the database. We need to add the web part to the Web Part Gallery before we can use it.

 

To do so, the following steps should be followed.

  1. Click on the Site Actions button and then select Site Settings.

image008.png

 

 

  1. On the site settings page under Galleries column click on the Web Parts.

 


image010.png

  1. On the Web Part Gallery Page click on the New button, to add the new web part assembly to the gallery.

 

image012.png

  1. On the New Web Parts page locate the NewWebPart in the list, check the check box on the left and click on the Populate Gallery button the top of the page. This will result in the Web Part entry creation in the Web Part Gallery list, and hence it can be used from now on from the gallery. It can be notices easily that the Web Parts developed form the new Frame work of 2.0 have an extension of .webpart after their names. Whereas in earlier versions, it was a .dwp file. Both the .webpart  and .dwp  files are the XML definition of the Web Part.

 

image014.png

  1. Until this step the web part is ready to be used on the site by selecting it from Web Part Gallery. Click on the Site Actions button on the page and then select Edit Page, this will modify the appearance of the page to enable the edit view. In this view Web Part Zones are highlighted so that a user can add a web part to the zone, Click on the Add a Web Part button in the left zone to add the Web Part.

 

image016.png

  1. Select the NewWebPart from the web part list . it is found under the Misc section and then click on�Advanced Web Part gallery and options.

 

image018.png

  1. In the�Add Web Part Pane at right , select Home  Gallery and then drag the NewWebPart from the pane into the Web Part Zone.

 

image021.jpg

  1. Click on the Exit Edit Mode link on the page and the site will return to the view mode.

image023.jpg

Feedback Comments
Records per Page
Page 1 of 5First   Previous   [1]  2  3  4  5  Next   Last   
pradeep Kumar Patnaik         11/15/2008 10:31:09 PM
webpart deployment It is really a good example of webpart deployment in sharepoint site. As i'm new to sharepoint I learned the way to deploy a webpart in SP site. Hope,In future you would help us in learning sharepoint more. Thank You Submitted By: pradeep Kumar Patnaik

pradeep Kumar Patnaik         11/15/2008 10:30:31 PM
webpart deployment It is really a good example of webpart deployment in sharepoint site. As i'm new to sharepoint I learned the way to deploy a webpart in SP site. Hope,In future you would help us in learning sharepoint more. Thank You Submitted By: pradeep Kumar Patnaik

Harikrishnan         11/9/2008 11:34:31 PM
not abtle to see "NewWebPart" in the add new webparts form. i have done as per your instructuion but i cant find NewWebPart in the new webparts list. Submitted By: Harikrishnan

Prashant Shah         10/16/2008 10:36:21 PM
Cal. Web part example its a realy a good example. thx for the help. regrads, Prashant Shah Jr. Soft Engg.(MOSS2007) Submitted By: Prashant Shah

Vijai Maharaj         10/15/2008 11:53:55 AM
Web Part for Transition of Images We have recently implemeted Moss 2007 but on our home page we have a built in Web Part which goes through an image gallery. What is happening is that in the back in it is actually javascript and apprently this code is making IE7 max out the CPU usuage. After research we have found some javascript code which does the same thing we desire. Now we would like to build a Custom Web Part using this Javascript code. Can you assist. Submitted By: Vijai Maharaj

Neesha         10/9/2008 7:27:09 AM
Need help Hi, I have uploaded a newssticker kind of a program using desinger on my sharepoint website. I have flash file, pictures and an xml file in place for it to work. Now, the problem is I need the end user to edit the xml file to add pictures, every week and I dont him to use the designer to edit this XML. I created a doc lib and copied the flash file,the xml file, and pictures. However for some reason, my flash program is reading data from the root xml in the designer but not from the doc lib.I need a way to upload the xml file on my sharepoint, so that end user will update the xml file when needed and will not go into the desinger to do that. Submitted By: Neesha

Jayashri Thorat         10/8/2008 5:45:38 AM
Nice Article - But have one doubt Hi, it is nice article. I m new to sharepoint and learning all these things. Actually u have mentioned that it will display today's date in gray color means selected, but at my side it is not displaying, i did same as u mentioned. Please tell me the reason. Submitted By: Jayashri Thorat

Prashant Sharma         10/5/2008 6:02:10 AM
Developing and Deploying Custom Web Parts for SharePoint Portal 2007 The above example is just great.this gives you a direction and stands as an base so that you can build more complex and customized webparts. This example really helped me through.... Gr8 work Submitted By: Prashant Sharma

         10/4/2008 3:07:27 AM
ddd

jagadeesh         10/3/2008 12:14:38 AM
thnaks its very usefull Submitted By: jagadeesh

Feedback





Enter the code shown above in the box below
Send

 

DNN Modules
SharePoint Web Parts
Flash Image Rotator for SharePoint 2007

Flash Image Rotator Web Part for SharePoint 2007 

 

Who would have thought? Flash with Sharepoint! The FIRST and ONLY flash rotation web part for Sharepoint. The Flash Image Rotator displays selected images and then rotates between the images. Several extended and optional features allow you to select the time to rotate each image, fade between i...more

Price: $129.99
 
Flash News Ticker for SharePoint 2007

Flash News Ticker Web Part for SharePoint 2007 

 

Provide current news items with a user-friendly news ticker for your Sharepoint Portal. With millions of web sites offering information you need a fun way to display information and the solution is Flash News Ticker....more

Price: $139.99
 
View Stock Quote Web Part

Stock Quote Web Part for SharePoint 2007

 

Giving your site visitors relevant information is critical. With the Data Springs Stock Web Part you can provide your users with up to date financial information....more

Price: $149.99
 
Random Image Web Part for SharePoint / MOSS 2007

Random Image Web Part for SharePoint 2007

With Random Image for Sharepoint 2007, you can select multiple images to display randomly when the web part loads...

Price: $139.99
 
SharePoint Charts Web Part

MOSS Charts Web Part for SharePoint 2007

The MOSS Chart Web Part is a web part built by Data Springs for the purpose of rendering several chart types based on data from a SharePoint list on a MOSS 2007 or WSS 3.0 Site ... more

Price: $269.99
 
Copyright 2005 - 2008 by Data Springs, Inc.
Contact Us | Terms Of Use | Privacy Statement