The second problem that you are having may very well be related to the first problem and the change that you have made.
When I do a test on this I can see that my query sets the data type to match the key column that I select in the wizard. In my test my key column was of type int and this is the type of data used in the query on the details page. What is the column that you choose as the key column in the wizard for this table and what is it's datatype in your db? I wonder if updating it to work with a varchar would resolve this problem.
Please post back with this info so we can look into this issue further.