Answered by:
Using Dynamic Data Web application as a Sub Project

Question
-
User-1312304163 posted
Hi:
I want to add a Dynamic Data Web Application as a Sub Project to an exsiting normal Web Application.
The structure like this:
The main application contains the web.config and resource, themes is WebAppMain
The Dynamic Data Web Applicaiton as Sub Project is WebAppSub
The WebAppSub locates at WebAppMain\UIS\WebAppSub
So the DynamicData folder locates at WebAppMain\UIS\WebAppSub\DynamicData\FiledTemplates\
I resiter the route at global.asax like:
routes.Add(new DynamicDataRoute("UIS/WebAppSub/{table}/ListDetails.aspx"){
Action = PageAction.List,ViewName = "ListDetails",Model = modelCodeAdmin,
RouteHandler = new DynamicDataRouteHandler(){
RootFolderVirtualPath =
"~/UIS/WebAppSub/DynamicData/"}
});
other settings are fine, the WebAppSub will output its dll to the WebAppMain's Bin folder and Model located at WebAppMain, the default pages is working and Model registered correclty. the only problem is, when the provider creates the template control,
the DynamicData.FieldTemplateFactory.GetFieldTemplateVirtualPathWithCaching can't get the correct directory, it throw a exception:
The field template folder '~/DynamicData/FieldTemplates/' does not exist
Can't find any Class that allow me to set the FileTemplate's Virtual Path, I know I can create a DynamicData/FieldTemplates at WebAppMain project.
but I think if I can use sub project's FileTemplates. It will give me more flexiblity. Is any one any opinion about it?
Thanks a lot!
Wednesday, September 10, 2008 8:36 PM
Answers
-
User-1312304163 posted
I find the answer, in the global.asax:
I put this two line codes:
// Setup the FieldTemplates Virtual Path FieldTemplateFactory Factory = (FieldTemplateFactory)modelWebSub.FieldTemplateFactory;Factory.TemplateFolderVirtualPath =
"~/UIS/UIWebSub/DynamicData/FieldTemplates";- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, September 10, 2008 9:25 PM -
All replies
-
User-1005219520 posted
Hi balancedu,
I don't think you want to change the routes.Add(new DynamicDataRoute("UIS/WebAppSub/{table}/ListDetails.aspx")
I've written a topic How To: Change the Dynamic Data Folder Location that shows how to do this. Let me know if you have any questions on the How To article.
Rick
ASP.Net UEWednesday, September 10, 2008 8:54 PM -
User1641955678 posted
Indeed, what Rick points you to should work. When using routing, it's important to understand the difference between:
-
What your URL's look like, which is driven by routing
-
Where your physical files are located
The page Rick points you to will let you change #2, though it's conceivable that you want to change both. But they are distinct things.
David
Wednesday, September 10, 2008 8:58 PM -
-
User-1312304163 posted
I find the answer, in the global.asax:
I put this two line codes:
// Setup the FieldTemplates Virtual Path FieldTemplateFactory Factory = (FieldTemplateFactory)modelWebSub.FieldTemplateFactory;Factory.TemplateFolderVirtualPath =
"~/UIS/UIWebSub/DynamicData/FieldTemplates";- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, September 10, 2008 9:25 PM -
User-1312304163 posted
Hi: ricka6
I have read your article, I am using the .Net 3.5, it seems the
model.DynamicDataFolderVirtualPath property doesn't in the dll I am using:
MetaModel modelCodeAdmin = new MetaModel();modelCodeAdmin.RegisterContext(typeof(EntitiesCode), new ContextConfiguration() { ScaffoldAllTables = true });What's wrong with my code?
I am using the<
add assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />Wednesday, September 10, 2008 9:36 PM -