Hot answers tagged visual-web-part
The error was due to my ViewFields SPQuery property settings. I must have been using the wrong field names. "Name" is supposed to be "LinkFilename" and "Url" is supposed to be "ServerUrl". I was basing the field names off the SPListItem object model names which are "Name" and "Url". Thanks to Atish for making me check my query results.
I found it here: https://social.msdn.microsoft.com/Forums/de-de/3c6f572b-fc0a-4be2-81c5-28d1220edcab/adding-a-custom-webpart-to-webpart-page-not-a-safe-control-issue?forum=sharepointdevelopment I had to copy the safe control entry in the web.config of the application.
Only top voted, non community-wiki answers of a minimum length are eligible