Search code examples
asp.netdynamic-data

Can inserts on ASP .net Dynamic Data be done on the same page with the list view?


I would like to have users insert and edit information about entities on the same page in a similar fashion to google alerts: http://www.google.com/alerts/manage Any advice on how this could be achieved?


Solution

  • It is possible changing the routing in the method RegisterRoutes in Global.asax as indicated in the remarks section present in the same file.

    Enabling this section:

    routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {
                      Action = PageAction.List,
                   ViewName = "ListDetails",
                   Model = DefaultModel
                });
    

    instead of the already enabled:

    routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action =  List|Details|Edit|Insert" }), Model = DefaultModel
                });
    

    It's also possible to enable custom routes for particular tables.