Wednesday, December 11, 2013

Multiselect in grid edit template.

When setting up a grid with a custom popup edit template, multiselects don't work quite as expected on save. They appear to bind the whole object, not the selected id values.

This snippet should be called as a create/update data formatter:

    .DataSource(c => c.Ajax()


function serialize(data) {
    if (data.FIELD_NAME != null) {
        var selected = data.FIELD_NAME;

        // Remove the old value to prevent binding conflicts.
        delete data.FIELD_NAME;    

        // Select out the values.
        for (var i = 0; i < selected.length; i++) {
            // Rebuild the field in a format friendly to ASP.Net MVC.
            data["FIELD_NAME[" + i + "]"] = selected[i].Value

Friday, December 6, 2013

MSBUILD : error MSB1008: Only one project can be specified.

I started switching projects over to a custom build process using community tasks. The TFS build points to a .proj file that then does some versioning for git and kicks off build and nugget or build and web deploy. Well, one project started giving me the error:

MSBUILD : error MSB1008: Only one project can be specified.
Switch: Production

It turns out the issue was in the build definition name - it had spaces in it. I renamed it from "Reslife Production Deploy" to just "Reslife.Publisher" and voila - works.