I came across a strange problem today when implementing a custom webpart. I was testing the webpart and when clicking a button on it (thus causing a postback) I was getting the error below:
“This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout.”
The common cause of this error is after migrating pages – it is usually due to the page layout url being hard coded to the website in which it was created. This is a bug and a pain – but it wasn’t the problem this time. Firstly, my page was loading fine – it was only throwing an error on postback. Secondly, I already checked the page definition and the reference was fine.
After doing much testing I finally narrowed it down to the fact that I had a querystring parameter with the name “id” – on changing the name of this parameter I found that the problem disappeared. Apparently there are few reserved query string parameters you shouldn’t use in your SharePoint web applications:
It does make sense that SharePoint has reserved parameters like these – but the error message was totally misleading!!