WALKTHROUGH: VS 2005 WebPart
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
WALKTHROUGH: VS 2005 WebPart

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Daniel Larson (www.portal
Guest





Posted: Mon Nov 07, 2005 9:51 am    Post subject: WALKTHROUGH: VS 2005 WebPart Reply with quote

In response to several NG posts, here is a BASIC walkthrough of creating a
simple WebPart for SharePoint using VS 2005.

1. Create a new project (class library).
2. Add a reference to C:\Program Files\Common Files\Microsoft Shared\web
server extensions\60\ISAPI\sharepoint.dll (assuming default US English
install... adjust the path accordingly).
3.Create a new WebPart class. Here is an example for BarPart in a
FooParts.proj:
-------------------------------------------------------------------

/* In web.config:
* <SafeControl Assembly="FooParts" Namespace="FooParts" TypeName="*"
Safe="True" />
* This assumes the assembly name is FooParts
*/
namespace FooParts
{
public class BarPart : Microsoft.SharePoint.WebPartPages.WebPart
{
protected override void CreateChildControls()
{
this.Controls.Add(new System.Web.UI.LiteralControl("hello fellow
SPGeeks"));
}
}
}

-------------------------------------------------------------------
4. Copy the dll to the bin directory.
5. Add the SafeControls entry to web.config (as in the code comment above).
6. Go to the newdwp page to add your new webpart to the gallery:
http://localhost/_layouts/1033/NewDwp.aspx
7. Now add it to your page.

That's it. Here are some clarifications:
-Whidbey WebParts are not SharePoint WebParts. Make sure you inherit from
the Microsoft.SharePoint.WebPartPages.WebPart class.
- Make sure you're running SP2 and are running the website in ASP.NET 2.0.

Please reply if you have any problems getting this running.

Daniel Larson
http://feeds.feedburner.com/daniellarson
Back to top
Harshawardhan Chiplonkar[
Guest





Posted: Tue Nov 08, 2005 1:50 am    Post subject: RE: WALKTHROUGH: VS 2005 WebPart Reply with quote

Great stuff daniel! Will really go a long way in bridging the learning
curve from .NET 1.1 to .NET 2.0
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB