How To: Manage Custom Controls In Team System and Web Access

22/10/2008

How To: Manage Custom Controls In Team System and Web Access

Here is couple of question I’m hearing from people about Custom Controls:

1. Why after I add a custom control to my work item I see an error message in the Web Access?

Unable to create workitem control

2. Even when I have Web Access Custom Control and Team System Custom Control I can’t get them to work together, always one of them shows me an error, Why?

|Web Access - Unable to create work item control

Custom Control in WinForm

Answers:

1. Custom Controls for Team System and for Web Access are different!
How To Write Team System Custom Controls
How To Write Web Access Custom Control

2.Because those Custom Controls are different you need to modify the Work Item definition for Team System and Web Access.

This is how you do it:

First install TFS PowerTools 2008.

Use Process Editor to export the Work Item we want to modify.

Export Work Item

After we export the work item to our local drive, open it for edit.

Inside the Work Item Definition Duplicate the <Layout> information and add Target Attribute.
One Layout with Target=”WinForms”
And the other one with Target=”Web”

Add new Layout

Now you got two options:

1. If you only have Team System Custom Control, Remove the Custom Control within the <Layout Target=”Web”> .
So now in the Team System you will see the custom control and in the Web Access this Custom Control will be gone!

2. If you have both Custom Controls , Web Access and Team System, just replace the name of the Custom Control.

<Layout Target=”WinForms”>
……
<Control Type=”Forms_CustomControl” Label=”Custom Control For WinForms” LabelPosition=”Left” />

<Layout Target=”Web”>
……
<Control Type=”Web_CustomControl” Label=”Custom Control For Web” LabelPosition=”Left” />

After you finish modifying the Work Item Definition use process editor to import the changes.

Import Work Item

Perform iisreset /restart to apply changes in Web Access.

Enjoy.

Add comment
facebook linkedin twitter email

Leave a Reply

11 comments

  1. Basti16/12/2008 ב 02:27

    Hello Shai,

    first of all, thank you for this article!
    As im having a problem with the Layout at the moment it left me with an idea.
    Is it possible to have a basic Layout, shown in the Team Explorer and a “special” Layout, which appears only in the WebAccess (it would not have any additional fields, it just would not show all fields available in the Team Explorer)?
    If it is, is it possible to handle such a behavior via the two Layout areas you mentioned (target=”web” / target=”winforms”) or did I misunderstand you and have to go an other way?
    If I got you wrong could you please give me a hint whether this is possible at all, because I´m stuck with this problem, as I´m new to the TFS-system.

    Best regards,
    Bastian

  2. Shai Raiten16/12/2008 ב 04:40

    Hi,

    Yes you can, as you can above you can create a different work item layout for Web and different work item layout for Team Explorer.

  3. Tommy03/01/2009 ב 00:39

    I was trying to use this for a custom winform app where I want to display the work item a bit differently, but the only display form loaded is the WinForm target. Could you have a custom target like “…” and I could load that DisplayForm instead of the default WinForms?

    Thanks!

    Tommy

  4. shair04/01/2009 ב 13:41

    Hi,

    This action is only for different layout between Web interface and Team Explorer.

    Why you need another Target?

  5. Tommy06/01/2009 ב 02:38

    I was wondering if I could use it for creating a different view/layout for a workitem displayed in a third party app I am writing.

  6. Basti21/01/2009 ב 13:33

    Hello,

    I got a problem now:
    I have two Layout sections and get each of them working on it´s own, but if I try to have both of them in my xml-file only one of them is recognized, as it seems.
    In my first section I have the target WinForms, and want to show all fields for example:




    and in the second Layout section for target web I only want to show field1 and field2, because field3 is not relevant for the customer.




    So now i would expect that I get a similar view in the WebAccess as in the TeamExplorer, but without field3 in the WebAccess.

    But for some reason it is the same as in the TeamExplorer and if I download the xml-file from the server again, the second layout section doesn´t even appear?

    Can you help me, please?

    Best regards,
    Basti

  7. shair21/01/2009 ב 13:42

    Tommy,

    I never tried that before but I think you can’t.

    Sorry.

  8. shair21/01/2009 ב 14:06

    Hello Basti,

    Are you using Process Editor? (TFS Power Tool)

  9. Basti21/01/2009 ב 14:44

    Hello Shai,

    no I´m not, because I don´t know how too set the second target using the Process Editor.
    So I export it via the Power Tool, and copy the XML-Code to an .txt file in which I edit the layout manually (copying the section, setting the targets and so on).
    Is there a way to edit the two sections in the Process Editor? I couldn´t find one.

  10. shair21/01/2009 ב 15:35

    Hi,

    Try import the xml file after the changes using witimport (http://msdn.microsoft.com/en-us/library/ms253163(VS.80).aspx)

  11. Basti21/01/2009 ב 16:22

    Perfect! It works now! Thank you very much for your great help!

    Best regards,
    Basti