Category Archives: Programming

Bootstrap Dropdown Selection

Unlike most dropdown controls in use across the web today, Bootstrap dropdowns don’t natively support selecting items in the list by typing the item you want to select out on your keyboard. On regular dropdowns, if your list has 2 items in it:

<label class="control-label">New / Used:</label>
<div class="dropdown">
   <button id="buttonSearchVehicleNewUsed" class="btn dropdown-toggle " type="button" data-toggle="dropdown">-- Select Type --</button>               
      <ul id="dropDownSearchVehicleNewUsed" class="dropdown-menu" role="menu">
         <li data-val="true"><a href="#">New</a></li>
         <li data-val="false"><a href="#">Used</a></li>
         <li data-val="false"><a href="#">UsedCPO</a></li>
      </ul>
   </div>
</div>

and you open the dropdown, you can normally only use the up and down arrows to select your item. If you modify your list to have dozens or hundreds of items, this can take a significant amount of time.

This plugin allows you to open the dropdown and type “U” to have the first item starting with the letter “U” to become focused. Additional typing will allow a more refined search “USEDC” would jump to the “UsedCPO”. This allows users to quickly get to the item they want. The project is on my GitHub: https://github.com/mlapaglia/Bootstrap-DropdownSelect

Merging TFS Branches with an EF Object Present

Visual Studio 2012 added integrated support for EDMX files. Being able to open and update the model from within the IDE allows for quick updates to the schema without using an external program or command line argument.

Adding EDMX files to source control is one of the largest pains a developer will ever face while merging a branch. When the design tool updates the schema in a EDMX file, it does so by completely wiping away the previous files (an EDMX is comprised of a *.cs file for each table in the database) and then recreating them with the updated schema. This present a large problem to TFS when you try and merge two branches that contain the same EDMX. TFS sees two separate files in both of the branches since it was deleted and then recreated. This blocks the ability to merge the changes because the manager will not allow merging changes between what it sees as “different” files.

After searching I came across this Stack Overflow thread with other developers in similar predicaments.

The simple solution I’ve found is to have only one developer update EDMX files when needed, and when merging to ignore the entire file from the merge. After the merge is complete go back into the solution and update the model from whichever database it needs to be pointed at.

The client I am currently working with requires the Cisco AnyConnect VPN solution to connect to their internal network for development. Their IIS and db servers require this due to being behind their firewall. Once connected with the Cisco client VS loses its ability to talk to the TFS. The solution must be taken offline by closing and opening the solution (or by using the “TFS Go-Offline” plugin). If you’re updating the EDMX offline I’ve found the most successful way is to select all the items in the designer, delete them, then save the EDMX, then update model from DB. Attempting to update the model without deleting them fails because the IDE needs to ask you if you’d like to overwrite the write-protected file (because you’re away from TFS the files can’t be checked out on the fly). If you update without deleting the update will fail silently, leaving you puzzled as to why you’re Intellisense is failing to pick up your new objects.