The Orbit Notebook Software Architecture, Development and Design Thoughts


ASP.NET Repeater – Get A Handle On Your Row

When it comes to the ASP.NET Repeater, I'm coming to find that there are twenty ways to "skin a cat", when it comes to getting a handle on the data and controls within the Repeater.  After writing entirely too much code and eventually finding a much easier way to handle this, I decided to pop a post.

Now, if you've worked with the Repeater for a while, you're familiar with the ItemDataBound event, and how you can get a handle on your controls by calling FindControl() to get a (boxed) instance of your control with which you may then set values, styles, etc.

But, what if you're handling an event of another control that's within your Repeater?  How, then can you get an instance of the Repeater -- or better yet, how can you get a handle on a different control in that row?  NamingContainer is how - it will give you the row that the current event call fired from.

Take this method, for example.  It's the SelectedIndexChanged event for a dropdownlist that's inside of my Repeater.  Not a big deal, but I want to update a label that's in the same row, but in a different column of my repeater.  Here's how it's done:


Filed under: ASP.NET, C#, Programming 2 Comments

Linking Changesets to Work Items in TFS (after the fact)

Lately, I’ve had a few occasions in Team Foundation Server, where I’ve checked in a bunch of code and forgotten to associate the files with a work item. Not a huge deal, but I like to have my changes grouped-up by the bug or work item, so it’s been worthwhile for me to make the association.

Linking a changeset to one or more work items after the initial check-in is really easy, although it's not too intuitive. The easiest way that I’ve found to accomplish this is to open your bug or work item in TFS and scan about a third of the way down the page to a group of tabs. Within these tabs is a “Links” tab:

Now, click this “Links” tab, to see any changesets (or test results, or other work items) that have already been associated with this work item:

From here, you can click “Add” and choose Changeset from the Link type dropdown list. Enter the number of the changeset and a comment, and voila.

Link added! I hope this saves you some time and searching.nn1

Filed under: Programming 1 Comment