ASP.NET Dynamic Data - Tips and Tricks #1
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.
Comments
- Anonymous
July 10, 2008
The comment has been removed