Basically, the field control is a easy implement to deploy.
There's a Field Control template within SharePoint template when you create by VS 2008.
Usually, best bet is create one by VS SharePoint template and test it out then pack by STSDEV and deploy. Here is the 10 main steps:
There's a Field Control template within SharePoint template when you create by VS 2008.
Usually, best bet is create one by VS SharePoint template and test it out then pack by STSDEV and deploy. Here is the 10 main steps:
- VS 2008 - Tools - STSDEV (need configured first), create a STSDEV solution by solution type: Empty solution (C# assembly), don't forget to create a correlative key.
- Open the C# solution and add a new SharePoint Empty project by this solution.
- Add a new Field Control into the SharePoint project.
- Create a XXXXFieldRending.ascx file to TEMPLATE\CONTROLTEMPLATES\XXXXFieldRending.ascx
Here is the example code:
<%@ Control Language="C#" Debug="true"%>
<%@ Assembly Name="Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>
<SharePoint:RenderingTemplate ID="KBIDFieldRendering" runat="server">
<Template>
<table class="ms-form">
<tr>
<td>
<asp:Literal ID="Desc_Category" runat="server"></asp:Literal>
<asp:Literal ID="Category" runat="server"></asp:Literal>
<asp:Literal ID="Desc_KBID" runat="server"></asp:Literal>
<asp:Literal ID="KBID" runat="server"></asp:Literal>
</td>
</tr>
</table>
</Template>
</SharePoint:RenderingTemplate> - Open TEMPLATE\XML\fldtypes_XXXX.xml, get assembly string and put in Field Name="FieldTypeClass", RenderPattern Name="DisplayPattern" can be finally put and test.
- Update and overwrite the XXXX\XXXX.FieldControl.cs
- Debugging and compiling SharePoint project to test working fine. (Need copy ascx, xml and dll file to correct system folders and then iisreset)
- Drag folder XXXX and TEMPLATE into the STSDEV project, XXXX within project root, TEMPLATE is supposed to put in Rootfiles\
- Debug and compile the STSDEV project at DebugBuild mode.
- Change mode to DebugDeploy and build STSDEV project for deploy to MOSS site. You will see the correct field type when you create a new column in site.
No comments:
Post a Comment