Saturday, January 19, 2008

Creating Webpart on Asp.Net 2.0 and Sharepoint

I. Steps

1. First Create a class library from asp.net 2.0

2. Modify assemblyInfo.cs under Properties by adding
[assembly: System.Security.AllowPartiallyTrustedCallers()]

3. rename the class from class1.cs to arunclass.cs. And then

namespace arunclasslibrary
{
public class ArunClass : using System.Web.UI.WebControls.WebParts.WebPart
{
private string dispString = "Arun's Site";

[WebBrowsable(true),Personalizable(true)]
public string DispString
{
set { dispString = value; }
get { return dispString; }
}

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
writer.Write(DispString);
}
}
}

4. click project properties and click signing tab, then select strong name ( with no password).

5. Build solution. And take the dll file and put into remote sharepoint site location such as
c:\inetpub\wwwroot\wss\virtualdirectories\anynumber\bin\arunclasslibrary.dll
and modify the web.config for adding safecontrol .

6. And then the rest are available in http://msdn2.microsoft.com/en-us/office/bb153523.aspx


II. http://www.c-sharpcorner.com/UploadFile/sarav82/webpartlifecycle01102008061313AM/webpartlifecycle.aspx

III. http://roddotnet.blogspot.com/2007/08/how-to-create-site-programmatically-in.html

IV. http://sorceresspy.wordpress.com/2008/03/29/wss-30-getting-started-site-provisioning/

No comments: