Tip #45: Did you know…How to change the DynamicData folder location?

ASP.NET Dynamic Data is a framework that lets you create data-driven ASP.NET Web applications easily. It does this by automatically discovering data-model metadata at run time and deriving UI behavior from it.

By default for a Dynamic data Web Application the dynamic data folder is created in the root folder. Your application might require it to be moved to a different location.

Following are the steps to achieve this in VS 2008 SP1.

  1. Choose which folder your want it to be moved to. For example, lets move it to admin folder. Create  admin folder and move DynamicData folder under it.

  2. In Global.asax  add the following

    model.DynamicDataFolderVirtualPath = "~/admin/DynamicData";

  3. Change the content of files under admin/Dynamicdata  you moved in step1 to reflect the new path location (~/admin/Dynamicdata). 

    For example,

    • change the register directive src attribute in List.aspx and ListDetails.aspx 
    • img src in List.aspx and master page
    • any other content which you might have customized and has to use the new path location

 

Deepak Verma
SDET | Visual Web Developer