[Sample of Apr 20th] Custom DataGrid Control for WebAccess

 

Homepage image
Sample of the Day RSS Feed

Sample Downloads
C# version:
https://code.msdn.microsoft.com/CSTFSWebAccessWorkItemDataG-c4cdf62b
VB version: https://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.

imageYou 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 https://1code.codeplex.com/.

 

Introduction

The CSTFSWebAccessWorkItemDataGridControl sample demonstrates how to create a Custom Data Grid work item control of TFS2010 WebAccess.

  1. Display a Field value in DataGrid
  2. Save the data in DataGrid to a WorkItem Field
  3. Support customize the Columns' Name
  4. 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

  • Microsoft.TeamFoundation.WorkItemTracking.Client
  • Microsoft.TeamFoundation.WebAccess.Controls
  • Microsoft.TeamFoundation.WebAccess.WorkItemTracking

 

Running the Sample

1.  Copy following items to C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Access\Web\App_Data\CustomControls.

DataGridControl.wicc

CSTFSWebAccessWorkItemDataGridControl.dll

2.  Use WitAdmin importwitd command line to import the WIT Controls (WIT Controls.xml) WorkItem Type.

See https://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.

 

More Information

Work Item Tracking Custom Controls

IWorkItemControl Interface