index > Team Foundation Server - Work Item Tracking > Custom Work Item Controls - How can you have one custom work item...

Custom Work Item Controls - How can you have one custom work item...


I want to create two custom work item controls. Each control will be a drop down list box. In the InvalidateDatasource() method of Control1, I retrieve information from a database, populate the drop down list box, check to see if a value has already been selected for the list box, and if so, set the list box equal to that value. I've got this working (which is pretty cool!).

Now, based on the contents of the first drop down list box, I want to filter what contents are in the second drop down list box, called Control2 (picture Control1 being a list of states, and Control2 being a list of cities, specific to which state is selected in Control1). How do I, from Control1.InvalidateDatasource(), trigger Control2.InvalidateDatasource()?

Control2.InvalidateDatasource() was where I was going to put the code to populate Control2 appropriately?

Control1 and Control2 are both user controls in the same assembly.

Does that make any sense, or do I need to provide more details?




VSTS MVP; http://www.teamsystemrocks.com/blogs/mickey_gousset
Mickey G

Mickey, you are right on where to put code to populate control2. When user selects a value in control1, set the value in associated field in WorkItem object, which then will trigger FieldChangedEvent and then the form will raise Invalidate for all controls. In summary, you need to set the associated field value when user selects an item in control1, and then you should get Invalidate on Control2.

BTW, you are the first one I know of who successfully used the custom controls feature. I heard couple of people not getting their dlls updated with SP1 setup. Did you have any problems or hickups getting up this far?

Thanks.




http://blogs.msdn.com/narend
Naren Datha - MSFT
Mickey, would like to know if you've had any issues.  I cannot get SP1 to update the required dlls.  My proof of concept time is running out and the PM is about to stop me looking into this.  (Naren, I'm also known as Aquilegia).
Acanthus

Hey Naren!

It doesn't quite seem to work.  When the user selects a value in Control1, it triggers the InvalidateDatasource() method for Control1 and Control1 only. It triggers the method because I invoke it from the SelectIndexChanged event of Control1).   Now the work item is marked as changed.  When I save the work item, it then triggers the InvalidateDatasource() method for Control2.  But what I want is, when the value is selected in Control1, for the InvalidateDatasource() to trigger for Control2.  I don't mind if InvalidateDatasource() is raised for all controls.  But currently it only happens on the Save, not when something is selected from the list box.

I didn't have any hiccups installing SP1.  It took a couple of changes on your example on your blog to get it running, but nothing major.  Let me get past this problem, and I'll go into some detail on what I did.

Any suggestions?

Thanks!

Mickey G.




VSTS MVP; http://www.teamsystemrocks.com/blogs/mickey_gousset
Mickey G
I won't able to say for sure what may be going to wrong without actually debugging, but I can give you a workaround if InvalidateDatasource is not working for you. You are getting an instance of WorkItem object in your control, and you can hook to its FieldChanged event in 2nd control. When 1st control updates a field value in workitem object, then you should get the FieldChanged event triggered and you could change the 2nd control accordingly.


http://blogs.msdn.com/narend
Naren Datha - MSFT
reply 5

You can use google to search for other answers

 

More Articles

Customized Fields on WorkItemChangeEvent
Status of a linked work item
How do I delte work items?
GCHandle exception when querying TFS from Word document
Attach a note to a work item
Web Bug Tracking for TFS
Query for Empty String
How does everyone else do it ?
Skip "validation errors" when doing bulk update from MS...
Problem with MS Project plugin
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Adding a camera or screen shot utility t…
Add multiple files as file attachment to…
purpose of not displayed fields in a wor…
What are the SQL queries to view and add…
Removing a work item
Web Bug Tracking for TFS
How to add custom fields that works like…
Work Item Update Collisions
MS Project Integration and Assigned To F…
TF80071 when trying to connect MPP to TFS
Error adding attachment with work item?
Add Users programatically
GCHandle exception when querying TFS fro…
Assigning same task to multiple resources
No way to update AreaPath dropdown throu…

Hot Articles

Linking Work Items
Using a Version Label in a WorkItem
Comparing fields of a Work Item when fil…
How to create AreaPath dropdown in winfo…
Build Integration clarification
Work item description formatting
Grouping Query Clauses
how to get active selection
How to: Change How Fields are Mapped to …
Actual End Date and Actual Effort
How to set permissions to a field in a w…
WI permission
TF80071 when trying to connect MPP to TFS
missing Microsoft.TeamFoundation.WorkIte…
Visual Studio Team Server as SourceSafe …

Recommend Articles

Reuse Dialog Boxes
Deleted AD resource causes publishing er…
Getting Email body part from an email us…
WorkItemStore null reference
List and explanation of Microsoft-namesp…
Customize the e-mail notification message
There is a way to make the link control …
Appending data to a work item field as o…
Where to get the hotfix for "This i…
Problem with MS Project plugin
Where is the Authoring Work Item Types.d…
Add Users programatically
Witimport - Replace or add... or an easi…
MS project 2003 bug with autolink when o…
query doesn`t work. problem < today