C# version: http://code.msdn.microsoft.com/CSTFSWebAccessWorkItemDataG-c4cdf62b
VB version: http://code.msdn.microsoft.com/VBTFSWebAccessWorkItemDataG-fa3fa520
Today’s code sample demonstrates how to create a Custom Data Grid work item control of TFS2010 WebAccess. It’s written by our star developer: Ruiz Yi.
You can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.
The CSTFSWebAccessWorkItemDataGridControl sample demonstrates how to create a Custom Data Grid work item control of TFS2010 WebAccess.
- Display a Field value in DataGrid
- Save the data in DataGrid to a WorkItem Field
- Support customize the Columns' Name
- Avoid Illegal characters
NOTE: The client javsscript uses Microsoft.XMLDOM to parse the xml, and it only works for IE
Building the Sample
This sample should be built on TFS2010 AppTier and the target framework is .NET Framework 3.5, because following assemblise are only available in the App Tier
Running the Sample
1. Copy following items to C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Access\Web\App_Data\CustomControls.
2. Use WitAdmin importwitd command line to import the WIT Controls (WIT Controls.xml) WorkItem Type.
See http://msdn.microsoft.com/en-us/library/dd312129.aspx. TFS Power Tools also supplies a more convenient approach.
3. Open Team WebAccess in IE, and connect to the Team Project to which you import the WIT Controls.
4. Create a new WIT Controls work item, and you will see
5. Type the title and data in the DataGrid, then save the work item.
6. If you add READONLY rule to Demo. GridField, or set the control as readonly, you will see
7. In the Visual Studio, you can also get the same result if you have used the CSTFSWorkItemDataGridControl.