If you're running into a problem similar to this one: "My Dynamic Data Web site is not working properly. My tables are read-only and no Edit/Delete/Insert buttons are displayed.", you might want to check the primary keys in your database.
One of the main reasons for this to happen is when you don't have the primary keys set in your database. Make sure you have primary keys defined for all your tables; otherwise, Dynamic Data doesn't enable the read-write mode. After you set the primary keys in your database, you must regenerate your data model.
Ok, so I've decided I'm gonna write a series of small and quick posts for Dynamic Data.
Today's post is about the following error message:"The control 'DataSource1' does not have a TableName property and a table name could not be inferred from the URL."
If you're using LINQ to SQL for your data model, this means that you're using a custom page that is not part of the URL routing set for your ASP.NET Dynamic Data application, so Dynamic Data cannot infer the table name from the URL as it would if the custom page was under the CustomPages folder. To solve this, just set the TableName to the table you want to access and the ContextTypeName property to your data context. Easy. Problem solved!
Now, if you're using LINQ to Entities for your data model, this error message can be misleading since the EntityDataSource control does not have a property called TableName. In this case, you need to set the EntitySetName property instead to the table you want to access and the ContextTypeName property to your data context.