Digital Tool Factory blog - Backend web development in Atlanta GA

The Digital Tool Factory Blog

How to fix the System.InvalidOperationException: The property ‘PropertyID’ is part of the object’s key information and cannot be modified problem

Often times when you are using Entity Framework and trying to update objects using the handy


Method you will encounter the error

InvalidOperationException: The property ‘PropertyID’ is part of the object’s key information and cannot be modified problem

After lots of thought I came across the remarkably simple answer, to wit – the PropertyID field is not being EXPLICITLY included in the object you are passing back to the controller.  Just put that in a “HiddenFor and you’re all set.

Nov 15

Written By Steve French


How to fix an odd problem with autonumeric.js

So, you’re using the standard autonumeric.js jquery plugin on your html 5 site – you set up the initialization properties and nothing happens – what is wrong?

First check to make sure that your textbox is of type “text” and not type “number” – that threw me for about ten minutes today.

Apr 15

Written By Steve French


How to fix problems with FoolProof Validation in mvc

For some reason the otherwise delightful nuget Package FoolProof Validation does not work with modern version of the entity framework – rather, the validation works just fine, but it chokes when you try to update the database with entity framework.

The workaround I found was to validate on a view model – and then translate that viewmodel to the actual model, which is then sent to the database.

Mar 15

Written By Steve French


How to fix problems with Jquery Validate and dynamically generated forms

I recently came across the problem of validating dynamically generated forms with the jquery.validate plugin – everything worked well with the original form, but when there were multiple forms available I got peculiar syntax errors. A quick googling told me to simply add the following code


to the javascript and everything would be fine. I tried that to no avail. Then I read things more closely and realized that I needed to specify which form I wanted to validate, I changed the code to


And voila! Problem so.

Mar 15

Written By Steve French


How to use query strings in framesets with mvc 5 routing

The problem – I was working on a project that required frames – and I was trying to pass a querystring value to the frameset, as in /FramePage/?page=/SomePageOffSite.aspx – my first thought was to just pass the url of one of the frames to the frameset page as a string.  I made the model for the view a string and attempted to pass it via the usual way in the controller, i.e.

return View(“MyFramedInPage.aspx”);

My thought was that I could just use the Model property as the url, as in

frame src=”@Model” name=”main” noresize scrolling=”auto” marginheight=”0″ marginwidth=”0″

However, whenever I did that MVC would try to find a view with the url of the string (in this case SomePageOffSite.aspx – which did not exist) I was passing in the model.  I eventually figured it out – there is a feature I never use on return View – to wit – you can redirect it to another view simply by passing in the view name (I always used the redirect option) – therefore you can’t ever use a model as a string.  Lesson learned.

Feb 15

Written By Steve French


How to web deploy to a virtual directory or web application in IIS and Visual Studio 2013

For whatever reason you cannot directly deploy (using Visual Studio WebDeploy) to a virtual directory in IIS.  This threw me for a bit until I created both the virtual directory, a separate website, and pointed them both to the same directory.  Then you just deploy to the otherwise unused website, and your web application shows up in your virtual directory

Dec 14

Written By Steve French


How to fix problems with 404 errors and ScriptResource.axd

I recently had this problem when working with an older site – I fixed it by changing the AppPool Managed Pipeline mode to “Classic”.

Why that worked I had no idea, but work it did!

Aug 14

Written By Steve French


How to fix problems with Visual Studio 2013 Web Deploy

Recently I began having problems with the Visual Studio Web Deploy feature – I did some googling and found that restarting the “Web Deploy Agent Service” fixes everything – I’m not sure why the service would lock up after a boot but that did fix it.

Jul 14

Written By Steve French


How to fix problems with small fonts when using the rotativa nuget package

Does the actual html look fine but the text on the printed pdf look way, way too small when you actually print the thing?

  1. In the MVC Controller – add in

    CustomSwitches = “–disable-smart-shrinking”,

  2. Check for long strings of unbroken text, in my case it was a fake underline of underscores (______) which was causing problems.

Blogged about largely in case I ever need to remember it later.

Jul 14

Written By Steve French MVC remote validation does not check for empty strings

This is a lesson I learn too frequently – mvc remote validation does not validate when the textbox (or whatever) is empty – it will not check empty strings and the event simply won’t fire.  Why it does this I don’t know but it does not.  I spent an annoying amount of time relearning that recently.  I guess Microsoft wants you to use the required validation fields first, but I run into many situations where the object is not required per se, but is required if some other data is entered.


What is the solution?  I’ve had great luck using MVC FoolProof Validation – available here.

May 14

Written By Steve French


Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.