Reputation: 7415
I've added in the Dynamic Data stuff to our existing website, and gotten that working as far as adding a DynamicDataManager to a page and setting a GridView to use it. However I think I'd like to get the full scaffolding functionality up and running so I don't have to write all the layouts for all the tables. Unfortunately I can't get it to work.
I've added code to Application_start() to register the data context and set up the route. I've tried with both "{table}/ListDetails.aspx" and "{table}/{action}.aspx" versions but I only get an HTTP 404 error. I also have ScaffoldAllTables set to true.
Am I missing a step or two here?
Here is my application start code:
protected void Application_Start(Object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
MetaModel model = new MetaModel();
model.RegisterContext(typeof(ESLinqDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.List,
ViewName = "ListDetails",
Model = model
});
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.Details,
ViewName = "ListDetails",
Model = model
});
}
Upvotes: 0
Views: 937
Reputation: 944
see:
Walkthrough: Adding Dynamic Data to an Existing Web Site
Scott Hunter : How to add Dynamic Data to an Existing Web Site
All the requirement s are there for getting DD working in a existing website.
Upvotes: 0
Reputation: 7415
I needed to add
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, publicKeyToken=31BF3856AD364E35" />
to the httmodules section of my web.config.
Upvotes: 1
Reputation: 780
Could you show your Application_start() code? And which version of IIS are you using?
A good explanation of adding Dynamic Data to an existing website can be found on Scott Hanselman's website: http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
Upvotes: 0
Reputation: 15599
Did you add this in your global.asax
model.RegisterContext(typeof(AdventureWorksLT_DataModel.AdventureWorksLT_DataEntities),
new ContextConfiguration() { ScaffoldAllTables = true });
http://msdn.microsoft.com/en-us/library/cc488469.aspx has a step by step walkthrough..see if you missed any.
Upvotes: 0