in

ASP.NET Weblogs

Tolga Koseoglu

SharePoint (MOSS) Installation and preparation for development

So, for the 20th time I am getting a development prepped for MOSS/WSS development. And, again, I forget how to get everything configured and installed. Hopefully this post will save some of you time in doing this.

  1. Install MOSS on Server 2008. Not straight forward. In order to get the install working you need to SlipStream the service packs for WSS and MOSS. (use command tool with the /extract command)
  2. Once MOSS is installed and you created a site collection you are ready to get the development environment ready. I recommend, Jan Tielens' Smart Part Templates.
  3. Make sure to select "SharePoint Web Part" not "Smart Part".
  4. Build the project and run the set-up.
  5. In MOSS, find "Site Collection Features" and activate your feature.
  6. If you database stuff, set trust level to full in web.config file
  7. If you like to load an .ascx file here is some code...

WebPart code

namespace SharePointWebPart1
{
    public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
    {       
        private System.Web.UI.Control control = null;       
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            control = this.Page.LoadControl(@"\WATG\MyControl.ascx");
            this.Controls.Add(control);
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            control.RenderControl(writer);
        }
    }
}

.Ascx Html 

<%@ Control Language="C#" AutoEventWireup="true" Inherits="SharePointWebPart1.MyControl" %>
<h3>This is my content</h3>

<asp:Button ID="btnTest" runat="server" Text="click me!" /> 

.Ascx code

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SharePointWebPart1
{
    public partial class MyControl : System.Web.UI.UserControl
    {
        protected Button btnTest;

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("Hello");

            this.btnTest.Click += new EventHandler(btnTest_Click);
        }

        void btnTest_Click(object sender, EventArgs e)
        {
            Response.Write("Great job!");
        }
    }
}

 

 

 

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About kemaltolga

Born in Ankara, Turkey. Raised in Germany. Recruited for the Track & Field Team at Texas A&M University in College Station, TX, in January 2000. NCAA champion in 2001 (Discus). Work for design firm in southern California. Married with two daughters.